
October 26th, 2011, 05:42 PM
|
|
Registered User
|
|
Join Date: Oct 2007
Posts: 5
Time spent in forums: 3 h 55 m 46 sec
Reputation Power: 0
|
|
|
Flash CS4 - ActionScript 3 - Making Multiple Scripts Work Together
I am creating a Flash header for class and two things need to happen - One, it needs a stop and start button, and 2 it has to be clickable.
I have the code for each one and they do work separately, but when I try to apply both, only one will work. Here are the codes that I am using:
For Stop and Start
Actionscript Code:
Original
- Actionscript Code |
|
|
|
start_btn.addEventListener(MouseEvent.CLICK, startMove); stop_btn.addEventListener(MouseEvent.CLICK, stopMove); function startMove(e:MouseEvent):void { play(); } function stopMove(e:MouseEvent):void { stop(); }
For Clickable Link
Actionscript Code:
Original
- Actionscript Code |
|
|
|
var movieContainer:MovieClip; var movieLoader:Loader = new Loader(); movieLoader.load(new URLRequest("header.swf")); movieLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, movieLoaded_fn); function movieLoaded_fn(e:Event): void { movieContainer = movieLoader.content as MovieClip; addChild(movieContainer); movieContainer.x = 100; movieContainer.addEventListener(MouseEvent.CLICK, callFunction_fn); } function callFunction_fn(e:MouseEvent): void { navigateToURL(new URLRequest("url is here")); };
I have tried reversing them in the actions panel but to no avail. Any help would be greatly appreciated.
|