-
Collision
I am new to flash. I would like to drag and drop multiple objects and on collision activate/play a video clip.
Pls show me what AS3 I can use?
Thanks.
Mgeni
-
Flash/Flex Developer
I would start at the drag and drop level. So a search for drag and drop using your preferred actionscript version and go from there. Don't try to do both functions from the start, learn as you go.
Some people are like Slinkies, not really good for anything, but they bring a smile to your face when pushed down the stairs.
-
Senior Member
Originally Posted by mgeni
I am new to flash. I would like to drag and drop multiple objects and on collision activate/play a video clip.
Pls show me what AS3 I can use?
Thanks.
Mgeni
I would use something like:
Actionscript Code:
var DraggingObject:*;
function GK_startDrag(drag):void{ DraggingObject = drag; addEventListener(Event.ENTER_FRAME, GK_moveObject); hitManager.addEventListener('HIT', GK_onHit); } function GK_stopDrag():void{ DraggingObject = null; removeEventListener(Event.ENTER_FRAME, GK_moveObject); hitManager.removeEventListener('HIT', GK_onHit); }
function GK_onHit(e:Event):void{ GK_stopDrag(); //Play a movie //or do anything! trace('BUMP!'); }
var hitManager:EventDispatcher = new EventDispatcher();
function GK_moveObject(e:Event):void{ DraggingObject.x = mouseX; DraggingObject.y = mouseY; CheckHit(); }
function CheckHit():void{ //make logic for all of for everything you want to check if it hits //for loop is your best bet if(DraggingObject.hitTestObject(box2)){ hitManager.dispatchEvent(new Event('HIT')); } }
GK_startDrag(box1)
Your lucky I love you so much,...
Here is a FLA showing it in action:
http://craigavenue.com/forumpics/DragExample.fla
it should be easy enough to follow what is going on here, but if not let me know!
Hope this helps!
-GK>'.'<
-
Flash/Flex Developer
Some people are like Slinkies, not really good for anything, but they bring a smile to your face when pushed down the stairs.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|