Added: 1 year ago
From: DNDigital
Views: 17,069
Sort by time | Sort by thread (beta)

Link to this comment:

Share to:

All Comments (46)

Sign In or Sign Up now to post a comment!
  • I didn't know Arnold Schwarzenegger could use Flash!

  • @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...

  • Cool stuff!! THX for sharing!!

  • 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!

  • 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 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.

  • Hi Teacher

    how we replace the Trolley after each drop ?

    and how we can give tshirts priority for dropping?

    Thx

  • @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.

  • Great Job! Thank you so much!

  • 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:

    package { public class {} } Hope that helps!

  • 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.MO­USE_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!

  • this is awesome. Thanks alot for sharing. I learned something new today.

  • @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.

  • 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!

  • Will this work in actionscript 2?

  • @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:

    while( numChildren > 0 )

    {  removeChildAt( i );

    }

    Hope that helps!

  • 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!

  • @DNDigital I'm In Atlantic Canada. :)

  • nice tutorial ty!

  • @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.

  • @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.

  • this tut is so complicated and sux

  • @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 was about to suggest that too :) Take a break from coding from time to time :)

  • LOL =)) i my bad... sorry.... blured eye sight.. it should be "Mouse Event" not Motion Event " xD

  • 1046: Type was not found or was not a compile-time constant: MotionEvent.

  • 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?

  • yes - this should work in all version of Flash, CS3, CS4 and CS5 - and any code editor or development environment you want to use.

  • does dis work in cs4

  • lol 666 views! Beware the devil =S Also great video :)

  • This video continues in Part 2 and Part 3...

Loading...
Alert icon
0 / 00Unsaved Playlist Return to active list
    1. Your queue is empty. Add videos to your queue using this button:
      or sign in to load a different list.
    Loading...Loading...Saving...
    • Clear all videos from this list
    • Learn more