Copy link to clipboard
Copied
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.
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
...Copy link to clipboard
Copied
where's the goto code?
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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);
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
you're welcome.
i don't download and correct files unless hired.
Copy link to clipboard
Copied
how many do you want ?
Copy link to clipboard
Copied
you're loading the following from what domain?
Copy link to clipboard
Copied
I want the doc parent "home" is local, and it download from this domain http://comm.alamaison.free.fr/test/
Copy link to clipboard
Copied
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)
Copy link to clipboard
Copied
you won't be able to do what you want because of security restrictions.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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).
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
you can use external swfs but code to control them should be in the main (loading) swf.
Copy link to clipboard
Copied
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);}
----------
Find more inspiration, events, and resources on the new Adobe Community
Explore Now