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

external swf

New Here ,
Mar 24, 2008 Mar 24, 2008
home page has 9 paintings (buttons), each should open a full new stage, identical to home but with different paintings in it. I created 9 swf's,each with it's own navigation and a button to take me home, a.s.o.
Nothing I tried, works ( loader, URLloader...) + 2 AS3 books
Would very much appreciate some help, the simplest, the better.
Thanks
TOPICS
ActionScript
866
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
Engaged ,
Mar 24, 2008 Mar 24, 2008
var loader:Loader = new Loader();
addChild(loader);

loader.load(new URLRequest("mySWF.swf")); //Load in SWF/PNG/JPG...

This will load an external swf into your movie, you can call loader.load() as each time a button is clicked and perhaps toggle the visibility of the 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 25, 2008 Mar 25, 2008
Thanks,

I managed to make it work by itself, but I have a hard time assigning a button to trigger the load.
Would you be so kind and help me again? Here is the script so far without the mouse down action:

var ldr:Loader = new Loader();
ldr.load(new URLRequest("MoonPage.swf"));
ldr.contentLoaderInfo.addEventListener(Event.COMPLETE, loaded);

function loaded(evt:Event):void {
addChild(evt.target.content);
}

Much obliged,
Dan
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
Engaged ,
Mar 25, 2008 Mar 25, 2008
Is MoonPage.swf the homepage - or is the hompage within the main 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
New Here ,
Mar 25, 2008 Mar 25, 2008
MoonPage.swf is one of 9 external swf's. The HomePage has 9 btn's that should take me to each one of the external swf's. Once the ext swf is loaded, I have a home btn that shoul take me back to the HomePage, aso. On a new test stage I succeeded to load an ext swf, but not triggered by a btn.
I'm not sure if I'm clear enough, but I surely need a helping hand.
Thanks again,
Dan

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
Engaged ,
Mar 25, 2008 Mar 25, 2008
Provided you have a button close_btn and thumb1_btn, thumb2_btn etc...
-------------------------------------------

var ldr:Loader = new Loader();
ldr.contentLoaderInfo.addEventListener(Event.COMPLETE, loaded);

close_btn.visible = false;

function loaded(ev:Event):void {
addChild(ldr);
close_btn.visible = true;
close_btn.addEventListener(MouseEvent.CLICK, closeLdr);
addChild(close_btn);
}

function closeLdr(ev:MouseEvent):void {
close_btn.removeEventListener(MouseEvent.CLICK, closeLdr);
close_btn.visible = false;
removeChild(ldr);
}

thumb1_btn.addEventListener(MouseEvent.CLICK, openThumb1);

function openThumb1(ev:MouseEvent):void {
ldr.load(new URLRequest("images1.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
Engaged ,
Mar 25, 2008 Mar 25, 2008
You'll also need to make a block so that you can't see through to the buttons. You could just make a movieclip that you can toggle the visibility of.
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 25, 2008 Mar 25, 2008
What is the close_btn doing"? Do I really need it?
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
Engaged ,
Mar 25, 2008 Mar 25, 2008
That is to close the SWF and return.
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 25, 2008 Mar 25, 2008
Nothing works!!!
except this loader, which acts on its own. How can I make it listen to a mouse down action?
Thanks again and please forgive my pestering and ignorance.

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 25, 2008 Mar 25, 2008
OOOPS
forgot the code:

var ldr:Loader = new Loader();
ldr.load(new URLRequest("MoonPage.swf"));
ldr.contentLoaderInfo.addEventListener(Event.COMPLETE, loaded);
function loaded(evt:Event):void {
addChild(evt.target.content);
}
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
Engaged ,
Mar 25, 2008 Mar 25, 2008
something.addEventListener(MouseEvent.MOUSE_DOWN, func);

However, I am not sure why this is not working. You have to duplicate the code to do with thumb1 for all the thumbs.

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

quote:

Originally posted by: fotografis
OOOPS
forgot the code:

var ldr:Loader = new Loader();
ldr.load(new URLRequest("MoonPage.swf"));
ldr.contentLoaderInfo.addEventListener(Event.COMPLETE, loaded);
function loaded(evt:Event):void {
addChild(evt.target.content);
}



This code should not be included. I have corrected it in the code above.
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 26, 2008 Mar 26, 2008
LATEST
Forgot to thank you.
If I can do anything for you besides Flash do not hesitate to contact me
Thanks a lot,
Dan
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