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

Actionscript 3 Scrollpane Component with MC containing buttons

New Here ,
Jan 04, 2019 Jan 04, 2019

New to Animate CC. Have been using Flash CS6 with this project for years with no issues because I was using the Normal Mode for creating actionscript. I have provided a graphic of the project below. I am using the Scrollpane Component at the bottom of the stage with a MovieClip containing buttons. When a specific button is selected it loads an external jpg at the stop on the stage. Each button within the MovieClip loads its own external jpg image. Any help would be greatly appreciated. Thanks and let me know if you need additional info.

AS3 Help.jpeg

457
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 , Jan 06, 2019 Jan 06, 2019

the same timeline (the main one) that applies addChild to your loader.

you can just edit the imageA and the for-loop's end.

there are lot's books and online resources for as3.  senocular was my personal favorite resoure when learning as3.

Translate
Community Expert ,
Jan 05, 2019 Jan 05, 2019

what's your question?

if it's how to encode what you described, what code worked with cs6 now fails?

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 ,
Jan 05, 2019 Jan 05, 2019

Thank you for the quick response.

I am using the following code on a button located inside the MovieClip that is located inside the Scrollpane Component to load an external jpg file:

import flash.net.URLRequest;

import flash.display.Loader;

import flash.events.MouseEvent;

var img1Request:URLRequest = new URLRequest("me.jpg");

var img1Loader:Loader = new Loader();

btn1.addEventListener(MouseEvent.CLICK, clickF);

function clickF(event:MouseEvent):void{

img1Loader.load(img1Request);

1;addChild(img1Loader);

}

I want the jpg to load at the top center of the stage but instead it is loading inside the Scrollpane Component. What code do I need to add to make this happen?

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 ,
Jan 05, 2019 Jan 05, 2019

that code's probably on the timeline of a movieclip that's in the scrollpane but i can't tell from what you posted.

you can try this.parent.addChild() and this.parent.parent.addChild() but better would be to put all your code on the main timeline and use something like,

yourmovieclip.btn1.addListener...

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 ,
Jan 05, 2019 Jan 05, 2019

No luck with the previous information but that could certainly be my lack of experience with AS3. Is there away for me to attach the FLA file and hopefully that would assist you in determining my error/s.

Thank you,

John

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 ,
Jan 05, 2019 Jan 05, 2019

no.  you would need to upload elsewhere and post a link.

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 ,
Jan 05, 2019 Jan 05, 2019

OK please download the files and see if this will help.

https://schools.risd.org/Page/7043

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 ,
Jan 05, 2019 Jan 05, 2019

all the code's on the main timeline:  http://www.kglad.com/Files/forums/scrollpane.fla

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 ,
Jan 06, 2019 Jan 06, 2019

A few closing questions:

Where would I place the code in the script to position the jpg in a specific x / y location ?

Do I use the same script for each button or simply add the name of the new jpg where you have currently placed var imageA:Array = ['placeholder.jpg','dog.swf','placeholder.jpg'] Do all the buttons need instance names?

Is there a resource that you recommend for beginners to learn AS3 from the ground up?

Thank you again for your patience.

John

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 ,
Jan 06, 2019 Jan 06, 2019
LATEST

the same timeline (the main one) that applies addChild to your loader.

you can just edit the imageA and the for-loop's end.

there are lot's books and online resources for as3.  senocular was my personal favorite resoure when learning as3.

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