@kevinduffy89 He IS very versatile!! There was a discussion about this on one of the other videos already by the way ;) Hope you enjoy the rest of the tutorials...
Why do you make so many folders? net.dndigital.dragdrop? I got it going on and it took me days. I am a rookie, but I got all the way with part one and part two and it works. The trouble I am having, is any adjustment I make to code will not take to be published. However, if I save the script file (WhiteShirt.as), then open it again, whatever previous changes I made to the external action script will take place. Why is that? I am using cs4 pro. Your remind me of my brother. Pure genius.158 IQ. :)
@YouSpamTard Maybe I should ask your brother to do these instead :) Make sure you save your .as file first before publishing - it's easy to forget. The folders are important as they prevent conflicts between different projects. You might be able to set up an empty folder structure that you use as a template for projects (eg. 'view', 'data', 'buttons' etc). External code editors (FlashDevelop is free, FlashBuilder costs) will create the folders for you automatically too. Hope that helps!
@JoaoSoaresLima If you've defined a custom class in the first 'Class' field, then you don't need to edit the BaseClass field (it should probably just say 'flash.display.MovieClip'). The first field defines the name of the class and you would normally put in a whole package identifier ('net.dnd.MyClass'). If you just put a single name ('MyClass') without a separate .as file, that also works - Flash will warn you and create its own class with that name based on 'base class' when you publish.
@Artinostiger Hiya - You can use 'addChild' to add new visual content in the drag-and-drop if-statement. I've replied in more detail to your direct message.
Hi Mr.DNDigital, I was following your tutorial using adobe flash cs5. I have an error when I try to test the movie saying " An ActionScript file must have at least one externally visible definition. I would appreciate your help. Thanks!
@Timoteo1996 Most probably that is because you forgot to put a 'public' keyword in front of your class definition. Best to go through the top of your Actionscript file and double-check the syntax. It should start with:
{ import flash.display.MovieClip; import flash.events.MouseEvent; public class red extends MovieClip { public function red() { buttonMode = true; addEventListener(MouseEvent.MOUSE_DOWN, down); } protected function down(event:MouseEvent ):void { startDrag(); } }
I'm trying to get to the dragging part but there is an error saying that it expected a right brace before the end of the program. Any help?
@Benmen776 I think it needs another } to close the package block - give that a try. It's also convention to use capital letters to name classes - eg. Red instead of red, so that you can tell them apart from variables. Hope that helps!
Hi, what can I do to make the original image stay in one place and only move copies? For example I am making a game to do table layouts for events, and the user needs to be able to drag copies of the same item multiple time (e.g tables, chairs etc) any help would be greatly appreciated cheers!
@shinypin I'm afraid not - these examples are all in AS3 only. Take a look at some of the other videos on here, they might allow you to make the switch.
@ninohck Yes - that's because they are added with code. Before you switch scenes, you can run something like this to remove all display objects from the stage:
This is great! I'm taking flash at college, and we learned just how you show it here. Your very good. ;) Also a great refresher for me, as I'm not so savy at advanced code, like Flash and data bases...as we are doing now.
@m33gzz I'm glad you're enjoying the tutorials! Where are you based? We have visited colleges / universities before to run Flash sessions, if you're in the UK, perhaps we could arrange for your college? Good luck with your studies in the meantime!
@scottsemulsion Hi Scottsemulsion - yes, that is possible. The 'if' statement that is used to detect the drop on the trolley (in part 3, I think?) is the key here- you can add lots of different functionality. To load a different SWF file, just use a Loader class at that point and attach it to the display list.
@Ahuitzotol Hi Ahuitzotol - which part did you think was the most complicated? It would be good to know, we are constantly trying to improve our training material.
I didn't know Arnold Schwarzenegger could use Flash!
kevinduffy89 2 weeks ago
@kevinduffy89 He IS very versatile!! There was a discussion about this on one of the other videos already by the way ;) Hope you enjoy the rest of the tutorials...
DNDigital 2 weeks ago
Cool stuff!! THX for sharing!!
CyberIllusions 2 months ago
Why do you make so many folders? net.dndigital.dragdrop? I got it going on and it took me days. I am a rookie, but I got all the way with part one and part two and it works. The trouble I am having, is any adjustment I make to code will not take to be published. However, if I save the script file (WhiteShirt.as), then open it again, whatever previous changes I made to the external action script will take place. Why is that? I am using cs4 pro. Your remind me of my brother. Pure genius.158 IQ. :)
YouSpamTard 2 months ago
@YouSpamTard Maybe I should ask your brother to do these instead :) Make sure you save your .as file first before publishing - it's easy to forget. The folders are important as they prevent conflicts between different projects. You might be able to set up an empty folder structure that you use as a template for projects (eg. 'view', 'data', 'buttons' etc). External code editors (FlashDevelop is free, FlashBuilder costs) will create the folders for you automatically too. Hope that helps!
DNDigital 2 months ago
Hello good afternoon
I have a question, when I go to the properties of the symbol in the "base class" should have written - flash.display.MovieClip
But this field goes out alone when I click "ok".
Are there connections between the movieclip and AS file, but gives no error and the code works correctly.
can you help me?
thank you
JoaoSoaresLima 3 months ago
@JoaoSoaresLima If you've defined a custom class in the first 'Class' field, then you don't need to edit the BaseClass field (it should probably just say 'flash.display.MovieClip'). The first field defines the name of the class and you would normally put in a whole package identifier ('net.dnd.MyClass'). If you just put a single name ('MyClass') without a separate .as file, that also works - Flash will warn you and create its own class with that name based on 'base class' when you publish.
DNDigital 2 months ago
This has been flagged as spam show
Hi Teacher
how we replace the Trolley after each drop ?
and how we can give tshirts priority for dropping?
Thx
Artinostiger 4 months ago
Hi Teacher
how we replace the Trolley after each drop ?
and how we can give tshirts priority for dropping?
Thx
Artinostiger 4 months ago
@Artinostiger Hiya - You can use 'addChild' to add new visual content in the drag-and-drop if-statement. I've replied in more detail to your direct message.
DNDigital 3 months ago
Great Job! Thank you so much!
holahopper 4 months ago
Hi Mr.DNDigital, I was following your tutorial using adobe flash cs5. I have an error when I try to test the movie saying " An ActionScript file must have at least one externally visible definition. I would appreciate your help. Thanks!
Timoteo1996 5 months ago
@Timoteo1996 Most probably that is because you forgot to put a 'public' keyword in front of your class definition. Best to go through the top of your Actionscript file and double-check the syntax. It should start with:
package { public class {} } Hope that helps!
DNDigital 5 months ago
My script is
package net.dndigital.dragdrop
{ import flash.display.MovieClip; import flash.events.MouseEvent; public class red extends MovieClip { public function red() { buttonMode = true; addEventListener(MouseEvent.MOUSE_DOWN, down); } protected function down(event:MouseEvent ):void { startDrag(); } }
I'm trying to get to the dragging part but there is an error saying that it expected a right brace before the end of the program. Any help?
Benmen776 7 months ago
@Benmen776 I think it needs another } to close the package block - give that a try. It's also convention to use capital letters to name classes - eg. Red instead of red, so that you can tell them apart from variables. Hope that helps!
DNDigital 7 months ago
this is awesome. Thanks alot for sharing. I learned something new today.
EthosKlaus 10 months ago
@ninohck I tried to write a reply but ran out of space in the comments. Here is a shorted version:
Add to draggableShirt:
static protected var DroppedShirts:uint = 0;
protected var wasDropped:Boolean = false;
and to the 'if( droptarget.parent......)' statement, add:
if( !wasDropped )
{ wasDropped = true; if( ++DroppedShirts == 2 ){ trace("You WIN!!!!"); }
}
Not enough characters to explain further but hope that helps you on your way.
DNDigital 11 months ago
Hi, what can I do to make the original image stay in one place and only move copies? For example I am making a game to do table layouts for events, and the user needs to be able to drag copies of the same item multiple time (e.g tables, chairs etc) any help would be greatly appreciated cheers!
FlyingKiwiProduction 11 months ago
Will this work in actionscript 2?
shinypin 11 months ago
@shinypin I'm afraid not - these examples are all in AS3 only. Take a look at some of the other videos on here, they might allow you to make the switch.
DNDigital 11 months ago
@ninohck Yes - that's because they are added with code. Before you switch scenes, you can run something like this to remove all display objects from the stage:
while( numChildren > 0 )
{ removeChildAt( i );
}
Hope that helps!
DNDigital 11 months ago
This is great! I'm taking flash at college, and we learned just how you show it here. Your very good. ;) Also a great refresher for me, as I'm not so savy at advanced code, like Flash and data bases...as we are doing now.
m33gzz 1 year ago
@m33gzz I'm glad you're enjoying the tutorials! Where are you based? We have visited colleges / universities before to run Flash sessions, if you're in the UK, perhaps we could arrange for your college? Good luck with your studies in the meantime!
DNDigital 1 year ago
@DNDigital I'm In Atlantic Canada. :)
m33gzz 1 year ago
nice tutorial ty!
FrozenShield 1 year ago
@scottsemulsion Yes, that's it. It can load images (jpg, png) or swf files. You use it like this:
var img:Loader = new Loader();
img.load( new URLRequest( "anim.swf" ) );
addChild( img); // add to the display list of your choice - this will probably add it to the t-shirt itself
Maybe try it in an empty file first so you can experiment more easily.
DNDigital 1 year ago
@scottsemulsion Hi Scottsemulsion - yes, that is possible. The 'if' statement that is used to detect the drop on the trolley (in part 3, I think?) is the key here- you can add lots of different functionality. To load a different SWF file, just use a Loader class at that point and attach it to the display list.
DNDigital 1 year ago
this tut is so complicated and sux
Ahuitzotol 1 year ago
@Ahuitzotol Hi Ahuitzotol - which part did you think was the most complicated? It would be good to know, we are constantly trying to improve our training material.
DNDigital 1 year ago
I was about to suggest that too :) Take a break from coding from time to time :)
DNDigital 1 year ago
LOL =)) i my bad... sorry.... blured eye sight.. it should be "Mouse Event" not Motion Event " xD
september231992 1 year ago
1046: Type was not found or was not a compile-time constant: MotionEvent.
september231992 1 year ago
protected function down (event:MotionEvent) :void im getting error in this part... type wasnt found or was not a compile time constant... how to fix?
september231992 1 year ago
yes - this should work in all version of Flash, CS3, CS4 and CS5 - and any code editor or development environment you want to use.
DNDigital 1 year ago
does dis work in cs4
RMSwinRatnayake 1 year ago
lol 666 views! Beware the devil =S Also great video :)
T3kB0i8P 1 year ago
This video continues in Part 2 and Part 3...
DNDigital 1 year ago