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

.swf PARENT and .swf CHILD (loader) - root/goto

Community Beginner ,
Jul 26, 2018 Jul 26, 2018

Hello,

(excuse my bad english)

I load a .swf Child from a .swf Parent with this code :

------------

var conteneurImage1:Loader = new Loader();

var image1:URLRequest = new URLRequest("URLadress");

conteneurImage1.load(image1);

this.addChild(conteneurImage1);

------------

When the Child is loaded, I want to create a button that goes to the parent instance in position 3. I write this :

------------

bouton2.addEventListener(MouseEvent.CLICK, bouton2d);

function bouton2d(event:MouseEvent):void

{MovieClip(root).gotoAndStop(3);}

------------

It does not work !

I try with "{MovieClip(parent.parent).gotoAndStop(3);}" or "{MovieClip(parent.parent).gotoAndStop(3);}"... Nothing !

The player goes to the position 3 at the Child. It stays in the Child.

I thank you VERY MUCH to help me.

605
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 Beginner , Jul 27, 2018 Jul 27, 2018

Thank you for your help.

If I have well understood. I can control the buttons in the clip-Child, from the clip-Parent. The bouton1 is in the clip-Child.

I try this, but it doesn't work. Where's my mistake ? This code is in the clip-Parent :

----------

var conteneurImage1:Loader = new Loader();

var image1:URLRequest = new URLRequest("URL/childa.swf");

conteneurImage1.load(image1);

this.addChild(conteneurImage1);

MovieClip(conteneurImage1.content).bouton1.addEventListener(MouseEvent.CLICK, bouton1d);

funct

...
Translate
Community Expert ,
Jul 27, 2018 Jul 27, 2018

where's the goto code?

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 Beginner ,
Jul 27, 2018 Jul 27, 2018

This code is in the .swf Child (root) . In red, you can find the goto code.

bouton2.addEventListener(MouseEvent.CLICK, bouton2d);

function bouton2d(event:MouseEvent):void

{MovieClip(root).gotoAndStop(3);}

I thank you

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 ,
Jul 27, 2018 Jul 27, 2018

what timeline relative to the main timeline?  what timeline is the loader relative to its (the loading swf) main timeline?  and what timeline do you want to direct?

if that code IS on the main timeline of the loaded swf and the loader is on the loading swf's main timeline AND you want to direct the main timeline of the loading swf:

MovieClip(this.parent.parent).gotoAndStop(3);

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 Beginner ,
Jul 27, 2018 Jul 27, 2018

Thank you for your reply. Then, I have this message :

SecurityError: Error #2047: Security sandbox violation: parent:

You can download the doc here, if you want.

I 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 ,
Jul 27, 2018 Jul 27, 2018

you're welcome.

i don't download and correct files unless hired.

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 Beginner ,
Jul 27, 2018 Jul 27, 2018

how many do you want ?

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 ,
Jul 27, 2018 Jul 27, 2018

you're loading the following from what domain?

http://comm.alamaison.free.fr/test/childb.swf"

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 Beginner ,
Jul 27, 2018 Jul 27, 2018

I want the doc parent "home" is local, and it download from this domain http://comm.alamaison.free.fr/test/

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 Beginner ,
Jul 27, 2018 Jul 27, 2018

I want to make a book "You are the hero" for tablet (apk) ; a story with illustrations. And, as it's very heavy (pictures), I hope to download the chapter from my domain. I hope you understand. (I'm french)

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 ,
Jul 27, 2018 Jul 27, 2018

you won't be able to do what you want because of security restrictions.

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 Beginner ,
Jul 27, 2018 Jul 27, 2018

OK. I thank you.

I'm not a society, and I really want to do this book. I can pay if someone can explain me how I can do, or give me a code, I can duplicate for all the book.

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 ,
Jul 27, 2018 Jul 27, 2018

you can't do exactly what you're trying.  you should be able to work around that however.

ideally you would have all your code in the main swf and none in the loaded swfs (other than this.stop() and this.goto's).

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 Beginner ,
Jul 27, 2018 Jul 27, 2018

I ever tried to write all the chapters in the main .swf, but it was too heavy for a talblet (pictures, musics, etc.). The tablet shut down. So, I thought I can be able to work around that if I can download the others chapters from a domain.

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 ,
Jul 27, 2018 Jul 27, 2018

you can use external swfs but code to control them should be in the main (loading) swf.

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 Beginner ,
Jul 27, 2018 Jul 27, 2018
LATEST

Thank you for your help.

If I have well understood. I can control the buttons in the clip-Child, from the clip-Parent. The bouton1 is in the clip-Child.

I try this, but it doesn't work. Where's my mistake ? This code is in the clip-Parent :

----------

var conteneurImage1:Loader = new Loader();

var image1:URLRequest = new URLRequest("URL/childa.swf");

conteneurImage1.load(image1);

this.addChild(conteneurImage1);

MovieClip(conteneurImage1.content).bouton1.addEventListener(MouseEvent.CLICK, bouton1d);

function bouton1d(event:MouseEvent):void

{MovieClip(this.parent.parent).gotoAndStop(1);}

MovieClip(conteneurImage1.content).bouton2.addEventListener(MouseEvent.CLICK, bouton2d);

function bouton2d(event:MouseEvent):void

{MovieClip(this.parent.parent).gotoAndStop(3);}

----------

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