Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Load movie through a button in Animate CC?

New Here ,
Mar 16, 2017 Mar 16, 2017

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

TOPICS
ActionScript
1.2K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Mar 16, 2017 Mar 16, 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);

}

Translate
Community Expert ,
Mar 16, 2017 Mar 16, 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);

}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 16, 2017 Mar 16, 2017

It works! Thank you very much!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 16, 2017 Mar 16, 2017
LATEST

you're welcome.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines