Copy link to clipboard
Copied
Let's say I have this button that when I click it, it loads an SWF file I targeted.
I know there is some ways to do this (by linking the button to a scene where it has the loadMovie script there using Go to Scene And Play), but is there another way to do it with just putting a loadMovie script in the button itself?
I tried using the ones from the code snippets and put it in the button, but it didn't work at all. It seems like you need a different codes for that.
I hope you can help me. Thank you!
OS: Windows 10
Program: Adobe Animate CC 2017
you can't attach code to buttons. you can attach code to a timeline that references that button.
var loader:Loader=new Loader();
var urlR:URLRequest=new URLRequest('path/filename.swf');
yourbutton.addEventListener(MouseEvent.CLICK,loadF);
function loadF(e:MouseEvent):void{
loader.load(urlR);
addChild(loader);
}
Copy link to clipboard
Copied
you can't attach code to buttons. you can attach code to a timeline that references that button.
var loader:Loader=new Loader();
var urlR:URLRequest=new URLRequest('path/filename.swf');
yourbutton.addEventListener(MouseEvent.CLICK,loadF);
function loadF(e:MouseEvent):void{
loader.load(urlR);
addChild(loader);
}
Copy link to clipboard
Copied
It works! Thank you very much! ![]()
Copy link to clipboard
Copied
you're welcome.
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more