Buttons in External SWF's
Using Flash CS3 AS2.0
I need to know if it is possible to make a button in an external
swf. file loaded in a Main .fla to link to another frame or label
in another external swf. movie. If so, how do I do it?
I have a main flash file for my website with a portfolio
gallery with 9 buttons.
I have 8 external .swf files for all my galleries. (eg.
branding.swf, packaging.swf, displays.swf, etc....)
Within those galleries I have 9 buttons that make up each
individual gallery.
The buttons reveal a large thumbnail with some text that
explain what the image is.
In some of the galleries I have some text that want the
viewer to be directed to another gallery to view another piece of
artwork that relates to this one.
These .swf files are loaded in my main flash file using the
loader components.
I thought I read somewhere that when you use the loader
components, action code will not work.
Do I need to change all my loader symbols to symbols that use
the _movieloader actioncode?
Here is a look at my test site to see what I am talking
about:
http://manganinc.pieper.com/piepert/index.htm
In the
Portfolio section you will find the gallery buttons and if
you click on
Product Packaging
(this is the first button), a .swf movie will load and 9
buttons slide down and when you click on the 3rd button over at the
top Nutro MAX Cat Bags will show up,
the text under the thumbnail will have text that reads "Also
see the
case study for this project."
This case study has a invisible button on top of it and I
want to direct that to the case studies page in my Main Flash file.
Another link is in the 2nd button down from the top in the
same gallery which is Autopage packaging. There is text under the
thumbnail that reads:
"Also see the
brochures and the
in-store display "
Here I need the button to link to the at least just the
brochures gallery and the displays gallery.
In my MAIN .fla I have all these galleries lableled. Meaning
in my action layer these sections are labeled to their according
gallery name.
Hope this makes sense. Please help me if you can!
if you're publishing for fp 10, use unloadAndStop() after the first load.
Similar Messages
-
Button from External SWF to Play Movie in Main SWF
Hi Guys,
Ok I'm working in Flash 8, Action Script 2;
I'm building a website, in which the 'Gallery Page' has a link to an external swf file, which is a scrolling clip of thumbnails.
What I want to do, is create each thumbnail into a button, which will then play a Movie Clip from a frame located in the Main swf file.
(So basically, each thumbnail button is a small photo, will play that photo in a large scale as a movie)
eg.
thumbnail1_btn needs to go to main swf and play movieclip1.mc, frame 1
thumbnail2_btn nends to go to main swf and play movieclip1.mc, frame 2
I'm unsure of the code for this? Or if I've built this up wrong?
If someone could help me out, that would be great!If you haven't set _lockroot on the loaded SWF, than a simple _root call from the loaded SWF will talk to the main SWF.
IE:
on(release){
_root.gotoAndPlay(1);
If you did set the lockroot, then call the level directly, via:
on(release){
_level0.gotoAndPlay(1);
Once on the root level, you can access a movie clip as normal.
So:
on(release){
_level0.movieClip1.gotoAndPlay(1);
will call the movie clip "movieClip1" which resides on the timeline of _level0 (which is main.swf in your instance), and tell it to jump to the first frame and start playing. -
Play - Pause button for external .swf?
I'm trying to create buttons so a viewer can pause and then play an externally loaded swf. My project can be accessed at the linke below. This is how I want the project to function
-Click a room on the building (choose Accounting for this discussion)
-Click one of the demo options (choose Ending a Period for this discussion)
- Now that the demo plays, I want the user to be able to play and pause the demo swf.
The demo .swfs were created in Captivate so I don't have access to their timeline. They are loaded into an empty Loader component using the MovieClipLoader Class. Can anyone post some possible solutions to this problem? Thanks!
http://distribution.activant.com/demos/prophet21-on-demand/What would that look like? Right now they're loading using the following code:
btnCashCollect_btn.onRelease = function () {
mcLoader.loadClip("CashCollections.swf",myLoader);
btnEndPeriod_btn.enabled = false;
btnCashCollect_btn.enabled = false;
btnFinancialMGMT_btn.enabled = false;
_root.btnHome_mc._visible = false;
So would I use something like:
btnPause.onRelease = function() {
myLoader.content.pause();
Actually I just tried that and it didn't work...I need the buttons to work for multiple external swfs that will be loaded into myLoader -
Enabling Parent button while external swf is loaded [AS3]
Hello everyone,
I am very new to Flash and it takes me a while to understand what code is trying to tell me
The problem I am currently facing is as follows:
After searching the net for hours I finally figured out, how to load an external swf into my main timeline. As far as I understand this main timeline is the "parent". Hence the loaded, external swf should be the "child" (a quiz).
Now the child (a quiz) loads into the flash file and is played properly, but I cannot access the button on the parent anymore. Unfortunately, I really need the home button on the parent to exit the quiz and allow for new navigation within the flash document.
I would greatly appreciate any help.
Thank you all in advance.
Kliph
my AS3 Code:
import flash.events.MouseEvent;
function onClick611 (event:MouseEvent) :void
gotoAndPlay("home_einf")
home_btn.addEventListener (MouseEvent.CLICK, onClick611);
import flash.net.URLRequest;
import flash.display.Loader;
import flash.events.Event;
import flash.events.ProgressEvent;
function startLoad()
var mLoader:Loader = new Loader();
var mRequest:URLRequest = new URLRequest("quiz.swf");
mLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onCompleteHandler);
mLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, onProgressHandler);
mLoader.load(mRequest);
function onCompleteHandler(loadEvent:Event)
addChild(loadEvent.currentTarget.content);
function onProgressHandler(mProgress:ProgressEvent)
var percent:Number = mProgress.bytesLoaded/mProgress.bytesTotal;
trace(percent);
startLoad();
stop();By simply using addChild like you have, you're placing the loaded content above everything on the display list - covering your button. There are a few ways to solve. The easiest, if it works for you, is to just make a new layer in your timeline - make it the top most layer, and place your home button in that layer.
Then change your addChild line from:
addChild(loadEvent.currentTarget.content);
to:
addChildAt(loadEvent.currentTarget.content, numChildren - 2);
This will place the loaded content behind the button.
Alternatively, you can set the button to export for AS and then add it after you add the loaded file. Or you can use content containers - empty sprites that you add first, and then fill with other objects, in order to control layering. -
I would like to automatically load an external swf inside an existing empty mc (or a new one) and load/unload different external swf on several button click fuctions. I've read the other posts, but none that quite facilitates accomplishing this.
This is what I have, I know it's messy- but I've been trying so many different methods until its probably loaded with irrelevant functions!
var myLoader:Loader = new Loader(); addChild(myLoader); var url:URLRequest = new URLRequest("homepage.swf"); myLoader.load(url);
myLoader.x=477;
myLoader.y=0;
/* Click to Load/Unload SWF or Image from a URL.
Clicking on the symbol instance loads and displays the specified SWF or image URL. Clicking on the symbol instance a second time unloads the SWF or image.
Instructions:
1. Replace "http://www.helpexamples.com/flash/images/image1.jpg" below with the desired URL address of the SWF or image. Keep the quotation marks ("").
2. Files from internet domains separate from the domain where the calling SWF resides cannot be loaded without special configuration.
button_1.addEventListener(MouseEvent.CLICK, fl_ClickToLoadUnloadSWF);
var fl_Loader:Loader;
//This variable keeps track of whether you want to load or unload the SWF
var fl_ToLoad:Boolean = true;
function fl_ClickToLoadUnloadSWF(event:MouseEvent):void
if(fl_ToLoad)
fl_Loader = new Loader();
fl_Loader.load(new URLRequest("homepage.swf"));
fl_Loader.x=477;
fl_Loader.y=0;
removeChild(myLoader);
removeChild(fl_Loader_2);
removeChild(fl_Loader_3);
removeChild(fl_Loader_4
addChild(fl_Loader);
else
fl_Loader.unload();
removeChild(fl_Loader);
removeChild(myLoader);
removeChild(fl_Loader_2);
removeChild(fl_Loader_3);
removeChild(fl_Loader_4);
fl_Loader = null;
// Toggle whether you want to load or unload the SWF
fl_ToLoad = !fl_ToLoad;
/* Click to Load/Unload SWF or Image from a URL.
Clicking on the symbol instance loads and displays the specified SWF or image URL. Clicking on the symbol instance a second time unloads the SWF or image.
Instructions:
1. Replace "http://www.helpexamples.com/flash/images/image1.jpg" below with the desired URL address of the SWF or image. Keep the quotation marks ("").
2. Files from internet domains separate from the domain where the calling SWF resides cannot be loaded without special configuration.
movieClip_2.addEventListener(MouseEvent.CLICK, fl_ClickToLoadUnloadSWF_2);
var fl_Loader_2:Loader;
//This variable keeps track of whether you want to load or unload the SWF
var fl_ToLoad_2:Boolean = true;
function fl_ClickToLoadUnloadSWF_2(event:MouseEvent):void
if(fl_ToLoad_2)
fl_Loader_2 = new Loader();
fl_Loader_2.load(new URLRequest("portfolio.swf"));
fl_Loader_2.x=477;
fl_Loader_2.y=0;
removeChild(myLoader);
removeChild(fl_Loader);
removeChild(fl_Loader_3);
removeChild(fl_Loader_4);
addChild(fl_Loader_2);
else
fl_Loader_2.unload();
removeChild(fl_Loader_2);
removeChild(fl_Loader);
removeChild(fl_Loader_3);
removeChild(fl_Loader_4);
fl_Loader_2 = null;
// Toggle whether you want to load or unload the SWF
fl_ToLoad_2 = !fl_ToLoad_2;
/* Click to Load/Unload SWF or Image from a URL.
Clicking on the symbol instance loads and displays the specified SWF or image URL. Clicking on the symbol instance a second time unloads the SWF or image.
Instructions:
1. Replace "http://www.helpexamples.com/flash/images/image1.jpg" below with the desired URL address of the SWF or image. Keep the quotation marks ("").
2. Files from internet domains separate from the domain where the calling SWF resides cannot be loaded without special configuration.
movieClip_3.addEventListener(MouseEvent.CLICK, fl_ClickToLoadUnloadSWF_3);
var fl_Loader_3:Loader;
//This variable keeps track of whether you want to load or unload the SWF
var fl_ToLoad_3:Boolean = true;
function fl_ClickToLoadUnloadSWF_3(event:MouseEvent):void
if(fl_ToLoad_3)
fl_Loader_3 = new Loader();
fl_Loader_3.load(new URLRequest("about.swf"));
fl_Loader_3.x=477;
fl_Loader_3.y=0;
removeChild(myLoader);
removeChild(fl_Loader_2);
removeChild(fl_Loader);
removeChild(fl_Loader_4);
addChild(fl_Loader_3);
else
fl_Loader_3.unload();
removeChild(fl_Loader_3);
removeChild(fl_Loader_2);
removeChild(fl_Loader);
removeChild(fl_Loader_4);
fl_Loader_3 = null;
// Toggle whether you want to load or unload the SWF
fl_ToLoad_3 = !fl_ToLoad_3;
/* Click to Load/Unload SWF or Image from a URL.
Clicking on the symbol instance loads and displays the specified SWF or image URL. Clicking on the symbol instance a second time unloads the SWF or image.
Instructions:
1. Replace "http://www.helpexamples.com/flash/images/image1.jpg" below with the desired URL address of the SWF or image. Keep the quotation marks ("").
2. Files from internet domains separate from the domain where the calling SWF resides cannot be loaded without special configuration.
movieClip_4.addEventListener(MouseEvent.CLICK, fl_ClickToLoadUnloadSWF_4);
var fl_Loader_4:Loader;
//This variable keeps track of whether you want to load or unload the SWF
var fl_ToLoad_4:Boolean = true;
function fl_ClickToLoadUnloadSWF_4(event:MouseEvent):void
if(fl_ToLoad_4)
fl_Loader_4 = new Loader();
fl_Loader_4.load(new URLRequest("contact.swf"));
fl_Loader_4.x=477;
fl_Loader_4.y=0;
removeChild(myLoader);
removeChild(fl_Loader_2);
removeChild(fl_Loader_3);
removeChild(fl_Loader);
addChild(fl_Loader_4);
else
fl_Loader_4.unload();
removeChild(fl_Loader_4);
removeChild(fl_Loader_2);
removeChild(fl_Loader_3);
removeChild(fl_Loader);
fl_Loader_4 = null;
// Toggle whether you want to load or unload the SWF
fl_ToLoad_4 = !fl_ToLoad_4;Kglad I read up on that but it's still not stopping.I'm publishing for fp 10 and have tried several different variations including:
function gofolio (e:MouseEvent):void{
imageLoader.load(navfolio);
addChild(imageLoader);
imageLoader.unloadAndStop(true);
folio_btn.addEventListener(MouseEvent.CLICK, gofolio);
function goabout (e:MouseEvent):void{
imageLoader.load(navabout);
addChild(imageLoader);
imageLoader.unloadAndStop(true);
removeChild(imageLoader)
imageLoader=null
about_btn.addEventListener(MouseEvent.CLICK, goabout);
....still not working. -
Place button rollover image on top of external swf
I have a menu that when you click on a button, an external swf is called up. However I would like for the buttons in the Over and Down state to show an image on top of the external swf with a description of what the video is about (Basically when they rollover the button).
The problem is that the image shows behind the external swf. I cannot get it to appear on top of the external swf. I have tried putting the buttons layer on top of the actions layer but that doesn't work.
I have not been using Flash for very long but I need to know if there is ActionScipt that can solve my problem or any other way to solve this issue. Please help. Thank you.This is what appeared now in my Output panel.
Core_K12_Menu CS5.swf Movie Report
Metadata
Bytes Value
387 <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"> <rdf:Description rdf:about="" xmlns:xmp="http://ns.adobe.com/xap/1.0/"> <xmp:CreatorTool>Adobe Flash Professional CS5</xmp:CreatorTool> <xmp:CreateDate>2010-07-25T19:31:59-07:00</xmp:CreateDate> <xmp:MetadataDate>2010-08-01T18:42:52-07:00</xmp:MetadataDate> <xmp:ModifyDate>2010-08-01T18:42:52-07:00</xmp:ModifyDate> </rdf:Description> <rdf:Description rdf:about="" xmlns:xmpMM="http://ns.adobe.com/xap/1.0/mm/" xmlns:stRef="http://ns.adobe.com/xap/1.0/sType/ResourceRef#"> <xmpMM:InstanceID>xmp.iid:2136C7DCCB9DDF11B1ACFFBB5C2D711F</xmpMM:InstanceID> <xmpMM:DocumentID>xmp.did:2136C7DCCB9DDF11B1ACFFBB5C2D711F</xmpMM:DocumentID> <xmpMM:OriginalDocumentID>xmp.did:423EF45B6198DF1180E5FB9309482BDA</xmpMM:OriginalDocumentID> <xmpMM:DerivedFrom rdf:parseType="Resource"> <stRef:instanceID>xmp.iid:992BC7CBB29DDF11B1ACFFBB5C2D711F</stRef:instanceID> <stRef:documentID>xmp.did:F34D8816A19DDF11ADEA81F4369F4B15</stRef:documentID> <stRef:originalDocumentID>xmp.did:423EF45B6198DF1180E5FB9309482BDA</stRef:originalDocumentID> </xmpMM:DerivedFrom> </rdf:Description> <rdf:Description rdf:about="" xmlns:dc="http://purl.org/dc/elements/1.1/"> <dc:format>application/x-shockwave-flash</dc:format> </rdf:Description> </rdf:RDF>
Frame # Frame Bytes Total Bytes Scene
1 295119 295119 Scene 1 (AS 3.0 Classes Export Frame)
Scene Shape Bytes Text Bytes ActionScript Bytes
Scene 1 0 0 1133
Symbol Shape Bytes Text Bytes ActionScript Bytes
ActiveMC 40 0 0
IntroModule 0 0 0
Module 1 Rollover 0 0 0
Module1 0 0 0
Module2 0 0 0
Module3 0 0 0
Module4 0 0 0
Module5 0 0 0
Module6 0 0 0
Module7 0 0 0
Module8 0 0 0
Module9 0 0 0
Module10 0 0 0
Module11 0 0 0
Module12 0 0 0
Module13 0 0 0
Module14 0 0 0
Module15 0 0 0
Module16 0 0 0
Module17 0 0 0
Module19 0 0 0
Module20 0 0 0
Module21 0 0 0
next_btn 0 0 0
replay_btn 0 0 0
Rollover 0 0 0
Rollover Image.psd 0 0 0
Symbol 18 0 0 0
Title.psd 0 0 0
ActionScript Bytes Location
1133 Scene 1:Frame 1
Bitmap Compressed Original Compression
Layer 1 3675 88264 JPEG Quality=80
Layer 1 3287 63936 JPEG Quality=80
Layer 1 1205 19668 JPEG Quality=80
Introduction-Up.jpg 6357 23200 Imported JPEG=102
Introduction-Down.jpg 5862 23200 Imported JPEG=102
Module 1-Up.jpg 5957 23200 Imported JPEG=102
Module 1-Down.jpg 5548 23200 Imported JPEG=102
Login Page and Tech Check Topics Covered - Introduction to A 4791 288576 JPEG Quality=80
Module 2-Up.jpg 6030 23200 Imported JPEG=102
Module 2-Down.jpg 5607 23200 Imported JPEG=102
Module 3-Up.jpg 6035 23200 Imported JPEG=102
Module 3-Down.jpg 5556 23200 Imported JPEG=102
Module 4-Up.jpg 5997 23200 Imported JPEG=102
Module 4-Down.jpg 5584 23200 Imported JPEG=102
Module 5-Up.jpg 6031 23200 Imported JPEG=102
Module 5-Down.jpg 5607 23200 Imported JPEG=102
Module 6-Up.jpg 6030 23200 Imported JPEG=102
Module 6-Down.jpg 5610 23200 Imported JPEG=102
Module 7-Up.jpg 5986 23200 Imported JPEG=102
Module 7-Down.jpg 5575 23200 Imported JPEG=102
Module 8-Up.jpg 6035 23200 Imported JPEG=102
Module 8-Down.jpg 5615 23200 Imported JPEG=102
Module 9-Up.jpg 6031 23200 Imported JPEG=102
Module 9-Down.jpg 5611 23200 Imported JPEG=102
Module 10-Up.jpg 6192 23200 Imported JPEG=102
Module 10-Down.jpg 5707 23200 Imported JPEG=102
Module 11-Up.jpg 6119 23200 Imported JPEG=102
Module 11-Down.jpg 5662 23200 Imported JPEG=102
Module 12-Up.jpg 6189 23200 Imported JPEG=102
Module 12-Down.jpg 5709 23200 Imported JPEG=102
Module 13-Up.jpg 6194 23200 Imported JPEG=102
Module 13-Down.jpg 5710 23200 Imported JPEG=102
Module 14-Up.jpg 6193 23200 Imported JPEG=102
Module 14-Down.jpg 5705 23200 Imported JPEG=102
Module 15-Up.jpg 6197 23200 Imported JPEG=102
Module 15-Down.jpg 5713 23200 Imported JPEG=102
Module 16-Up.jpg 6202 23200 Imported JPEG=102
Module 16-Down.jpg 5716 23200 Imported JPEG=102
Module 17-Up.jpg 6155 23200 Imported JPEG=102
Module 17-Down.jpg 5684 23200 Imported JPEG=102
Module 18-Up.jpg 6204 23200 Imported JPEG=102
Module 18-Down.jpg 5719 23200 Imported JPEG=102
Module 19-Up.jpg 6198 23200 Imported JPEG=102
Module 19-Down.jpg 5713 23200 Imported JPEG=102
Module 20-Up.jpg 6205 23200 Imported JPEG=102
Module 20-Down.jpg 5723 23200 Imported JPEG=102
Module 21-Up.jpg 6150 23200 Imported JPEG=102
Module 21-Down.jpg 5685 23200 Imported JPEG=102
Replay Button.jpg 5365 18240 Imported JPEG=102
Replay Button Down.jpg 4803 18240 Imported JPEG=102
Next Button.jpg 4965 18240 Imported JPEG=102
Next Button Down.jpg 4684 18240 Imported JPEG=102 -
How to unload the external .swf file when move on to other section?
Hi,
The following code provided by Mr. kglad works great in loading an external .swf file onto stage. Now, when I click on Contact (Button), the external .swf file to be removed completely. How to code on contact (Button) to work it out.
Gallery.addEventListener(MouseEvent.CLICK, GalleryClick);
function GalleryClick(e:Event):void{
if(currentClip != Gallery_mc){
currentClip.visible = false;
Gallery_mc.visible =true;
currentClip =Gallery_mc;}
var loader:Loader=new Loader();
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, ClipLoaded);
loader.load(new URLRequest("Gallery.swf"));
function ClipLoaded(e:Event):void{
Gallery_mc.addChild(loader);
loader.x=0;
loader.y=120;
loader.width=1000;
loader.height=700
I tried the following code for Contact_btn to unload the Gallery.swf file which throws an error: 1120: Access of undefined property loader.
Contact.addEventListener(MouseEvent.CLICK, ContactClick);
function ContactClick(e:Event):void{
if(currentClip != Cotnact_mc){
currentClip.visible = false;
Cotnact_mc.visible =true;
currentClip = Cotnact_mc;
Gallery_mc.removeChild(loader);}}like so:
Gallery.addEventListener(MouseEvent.CLICK, GalleryClick);
function GalleryClick(e:Event):void{
if(currentClip != Gallery_mc){
currentClip.visible = false;
Gallery_mc.visible =true;
currentClip =Gallery_mc;}
var loader:Loader=new Loader();
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, ClipLoaded);
loader.load(new URLRequest("Gallery.swf"));
function ClipLoaded(e:Event):void{
loader.contentLoaderInfo.removeEventListener(Event.COMPLETE, ClipLoaded);
Gallery_mc.addChild(loader);
loader.x=0;
loader.y=120;
loader.width=1000;
loader.height=700
I tried the following code for Contact_btn to unload the Gallery.swf file which throws an error: 1120: Access of undefined property loader.
Contact.addEventListener(MouseEvent.CLICK, ContactClick);
function ContactClick(e:Event):void{
if(currentClip != Cotnact_mc){
currentClip.visible = false;
Cotnact_mc.visible =true;
currentClip = Cotnact_mc;
if(loader){
if(loader.stage){
gallery_mc.removeChild(loader);
loader.unloadAndStop(); // for fp 10+
loader=null; // if loader no longer needed -
Hi, everybody...
I have to realize a videocommunication, whit Apache web server and FMS 3. This's ok...
I have a button that load an external .swf but, when the 2 client are into communication, when I push the button, the external .swf starts only on the local client and not on the other client.
Can someone help me?
Thanks.
Emiliano.Hi Csound1, thanks. The email host is 1and1.co.uk, however, i am going to fess up and make myself look like a plonker now -
the email account in question was set up in Outlook as POP - stupid, stupid, stupid me, wasted an afternoon on this! I have now changed the Outlook account to IMAP and Mail.app works perfectly - and looks much nicer than Outlook did. Im in the middle of converting from Windows to a Mac, and still finding my way around the Mac
The lesson learned, never assume - always double check! All my other email addresses with 1and1 are all imap, except this one, and it happened to be the first one I set up in the Mail.app. (bows head in disgrace!)
Thank you anyway for attempting to help me!
Cheers -
UNLOADING EXTERNAL SWF. SOMEONE HELP!
I have a menu in my site and i recently added a comment form that is loaded when you click one of the buttons of the menu.
My problem is that when I click on a different menu button the external swf [comment form] its still there I've tried adding the unloadMovie
option but its not working. Here is the code for both buttons.
---------------------HOME BTN:
on (rollOver) {
gotoAndPlay(2);
on (rollOut) {
gotoAndPlay(6);
on (release) {
if (_root.choose != "home" && _root._currentframe!=30) {
_root.play();
_root.choose = "home";
//mysound = new Sound();
//mysound.attachSound("soundClick");
//mysound.start();
--------------------COMMENT FORM BTN:
on (rollOver) {
gotoAndPlay(2);
on (rollOut) {
gotoAndPlay(6);
on (release) {
if (_root.choose != "contact") {
_root.play();
_root.choose = "contact";unloadMovie() will work if there's a movie clip to be referenced. If you have assigned a name to the loaded movie you can unload it with unloadMovie(). Another option is to call unloadMovie() from the clip itself like: my_loaded_mc.unloadMovie(this); In every case check for incorrect paths (if you load a movie and refer to _root - the root will be the root of the loader, not the movie itself)
Emil Georgiev - Flash and Web Design -
Play exit animations on multiple external SWF's?
Hi,
Here is what I would like to do: I have some buttons, then 2
movie clips named container and container2. When I click on a
button, an external SWF is loaded into container. I have it working
so that when another button is clicked, it plays the exit animation
of the current SWF, then loads the new one. Here is the code that I
used for that:
on a button:
Code:
on (release) {
if (_root.currMovie == undefined) {
_root.currMovie = "who";
container.loadMovie("who.swf");
} else if (_root.currMovie != "who") {
if (container._currentframe >= container.midframe) {
_root.currMovie = "who";
container.play();
In who.swf frame 1:
Code:
midframe = 114;
In who.swf last frame:
Code:
_root.currMovie = undefined;
stop();
Frame 114 is where the exit animation starts.
What I would like to do, is have a button in who.swf, that
will load another external swf into container2, while leaving
who.swf in place. Then, when one of the main buttons is clicked, I
would like it to play the exit animation of the swf that is
currently in container2, then play the exit animation of the swf
that is currently in container, then load the new swf into
container. Can someone please help me out with the code for that?
Thanks!the thing is that i had to keep a reference to my Loader.
if you dont keep a reference to the Loader who is processing the loadBytes(), the Garbage Collector could close the Loader, wich causes the loader to unload.
i tried this with a test, i load 1 swf binary with an urlloader, and in the complete-event i create 100 loaders wich do a loadBytes on the loaded bytes.
the FlashBuilder console traces 100x [SWF] <path> 1000 bytes after decompression, and sometimes i get a whole bunch of [Unload SWF]
this is because i dont keep any reference to the Loader. if i would keep a reference to the loader stored in an array, i dont get the unload. when the loader is done, you can store the content in a variable, and remove the loader, but as long as its loading, you should keep a reference to the loader.
Hope this helps others.
p.s. i keep seeing [SWF] Main.swf instead of [SWF] <loaded swf file> is because i load the swf with an URLLoader (wich gives no trace), but when i do a loadBytes, it doesnt know its path anymore, so you get the root-swf, Main.swf in this case. -
I know that the question sounds confusing. I am new to AS3 but a little dangerous with it.
The project
I'm putting together a website tour with has a main .fla with navigation buttons. The navigation buttons load external .swfs using X and Y properties. Every external .swf houses a scrubber bar, play pause buttons which calls to a movie clip which houses the animation.
The problem:
Everything was working great, until someone mentioned "Hey, what if at the end of each loaded external .swf, a button appears that says "go to next section".
So basically we are trying to give the user another way to get to the next section in the left hand navigation once the animation ends, in addition to being able to click in the left hand navigation for the next section. It's kind of like when a youTube video ends and it displays a button to go to the next movie that's in line, but you can also do it in the thumnail navigation as well.
Ok, let's try it. Well, after many nights, searching the web and trying everything I am waving the white flag. I went through the lynda.com book over and over but I get an error message when I add code related to the parent timeline. I can actually get the next section to load on top of the previously loaded .swf, but it's buggy and I think the previous section is showing through underneath. Plus the scrubber isn't really working right. Since every .swf has a scrubber to control it, shouldn't it just load on top of the previous .swf? Do I need to add coding related to the parent timeline?
I don't know if I should paste my code here, I have a sample .fla too. Help is so greatly appreciated!!!! If this can work, I think it would be very useful for anyone else doing something like this - I would definitely share any knowledge gained!
Thanks.
JenIf you want to utilize that code as a starting point (hopefully you understand what it does, and that the code actually works), then you need to modify it such that the array at the start has your filenames instead of the three it now shows, and the three buttons it uses are changed to the next and previous buttons you intend to use. Here are the functions you need to make adjustments to...
function onCompletePreloading():void {
_loadedSWFs = 0;
contentContainer.addChild(_swfClipsArr[_loadedSWFs]);
next_btn.addEventListener(MouseEvent.CLICK, setContent);
prev_btn.addEventListener(MouseEvent.CLICK, setContent);
function setContent(event:MouseEvent):void {
var _swfToAdd:MovieClip;
if(event.currentTarget.name == "next_btn") {
_loadedSWFs += 1;
if(_loadedSWFs == _swfClipsArr.length){
_loadedSWFs = 0;
} else if(event.currentTarget.name == "prev_btn"){
_loadedSWFs -= 1;
if(_loadedSWFs == -1){
_loadedSWFs = _swfClipsArr.length-1;
_swfToAdd = _swfClipsArr[_loadedSWFs];
contentContainer.removeChildAt(contentContainer.numChildren-1);
contentContainer.addChild(_swfToAdd);
trace(_swfToAdd.customID); -
Hi,
I have an external photo gallery with a previous and next
buttons that loads into a main swf. When I test the external swf on
its own the buttons work fine. But, when I load the external swf in
the main swf the buttons work once and to make them work again you
have to move your mouse a little to make it work again. You can not
just leave your mouse over the button and just keep on clicking the
way it works when I test the swf on its own.
Is there away to make it work without moving the mouse after
each click?
Thanks in advanceHi I am using AS3
button_3.addEventListner(MouseEvent.CLICK,fl_ClickToLoadUnloadSWF_3);
var fl_Loader_3:loader;
var fl_ToLoad_3:Boolean=true;
function fl_ClickToLoadUnloadSWF_3(event:mouseEvent):void
if(fl_ToLoad_3)
fl_Loader_3 = new Loader();
fl_loader_3.load(new URLRequest("new_products.swf"));
addChild(fl_Loader_3);
else
fl_Loader_3.unload();
removeChild(fl_Loader_3);
fl_loader_3+null;
fl_TOLoad_3 =!fl_ToLoad_3;
This is the first half of the code for one button, the code for the second button is the same, just different variable names.
thanks -
Unloading a loaded external SWF with a close button on the external SWF to unload
I have found some discussion on this topic but I am still having trouble getting it to work and was hoping to get some help here.
Here I have a file: http://www.dril-quip.com/test/main.swf
I have: main.swf (a menu) and I have module.swf (content)
If you navigate to Subsea Wellhead Systems/SS-15 BigBore II and click on that I have it load an external swf which covers most of the parent.
So far so good. My problem is unloading the loaded 'Child' swf with the button provided on the loaded 'Child' swf.
below is the code I used to load the file but I cant, for the life of me, find a way to unload it.
var bigboreLoader:Loader = new Loader();
btnbb2.addEventListener(MouseEvent.MOUSE_UP, bigborecontent);
function bigborecontent(event:MouseEvent):void{
var bigboreRequest:URLRequest = new URLRequest("moduletemplate.swf");
bigboreLoader.load(bigboreRequest);
stage.addChild(bigboreLoader);
I am certain it requires the Child to communicate with the parent somehow but I am at a loss. If I could get a bit of advice or a link to something deal with this, it would be a big help. I just need to have my links load my modules and the remove them when the close buttong is hit on the loaded swf. I promise I have done searches and I admit I have found asnwers but still they are not working. I found the code below:
Main FLA:
function removeF() {
removeChild(bigboreLoader);
var bigboreLoader:Loader = new Loader();
btnbb2.addEventListener(MouseEvent.MOUSE_UP, bigborecontent);
function bigborecontent(event:MouseEvent):void{
var bigboreRequest:URLRequest = new URLRequest("moduletemplate.swf");
bigboreLoader.load(bigboreRequest);
stage.addChild(bigboreLoader);
EXTERNAL FLA:
btnClose2.addEventListener(MouseEvent.CLICK, bigborecontent);
function bigborecontent(myevent:MouseEvent):void {
MovieClip(parent.parent).removeF();
I think I have a misunderstanding of the code. Thanks for any help you might be able to provide.This was the original code I got:
Main FLA: (on AS layer inside DropDownButton Movie Object)
function removeF() {
removeChild(myLoader);
var myLoader:Loader=new Loader ();
page1_mc.addEventListener(MouseEvent.CLICK, page1content);
function page1content(myevent:MouseEvent):void {
var myURL:URLRequest=new URLRequest("page1.swf");
myLoader.load(myURL);
addChild(myLoader);
EXTERNAL FLA: (on main time line of this file)
close_mc.addEventListener(MouseEvent.CLICK, closeMC);
function closeMC(myevent:MouseEvent):void {
MovieClip(parent.parent).removeF();
Main.FLA
myLoader=bigboreLoader (my new loader)
page1_mc=btnbb2 (the button who event will call external swf)
page1content = bigborecontent (name given to SWF being loaded???)
myURL=bigboreRequest (my new URLrequest for bigbore)
page1.swf=moduletemplate.swf (actual address of what I am loading)
External.FLA
close_mc=button that will close external swf
closeMC=movie clip to close? -
AS3 loading external swf files with buttons from inside a movieclip
In my main .swf I have labels on the timeline, navs for those btns are on the first frame of the AS layer and each button sends the playhead to a different frame.
On one frame called fr1 there is an mc called mc_1 that appears on stage when the playhead stops there. Inside mc_1 are a set of navigation buttons that need to call external .swfs.
Do I add event listeners on the last frame of mc_1 for each button?
how do I call the loaders for the swfs on the buttons since the swfs will load on the main timeline NOT the mc_1 timeline?
So label on main timeline called fr1 will load external1 swf , on fr10 external 2.swf will load and so on.
any help?The code for that button's event listener needs to be placed wherever it has direct access to the button. Not necessarily on the same timeline, but in a place where both the button and the code are present at the same time.
The code could be placed at the frame in the main timeline where the movieclip with the button(s) is, targeting the buttons via the movieclip (mc.button.addEvemtListener...) , unless the buttons are somewhere down the timeline of that movieclip.
If they are down the timeline of that movieclip, then you would need to have the event listener also inside the movieclip, down its timeline where the buttons are finally settled in... being sure to assign instance names to the buttons at every keyframe. -
Hello Guyz.
i am working on Macromedia Flash 8 and i just want to call a external SWF when i press the button within another SWF file.......but the second SWF file play Externely............can any one knows the code.... AS2try this
http://www.actionscript.org/forums/showthread.php3?s=&threadid=28123
Maybe you are looking for
-
IPhone photos not syncing to Pictures folder after upgrade to OS 10.6
I recently switched MacBooks, using a Time Machine backup, and am now on OS 10.6.3. I'm running iTunes 9.1.1, and my iPhone OS is 3.1.3 Before switching computers, the photos on my iPhone would sync to my Pictures folder on the MacBook. They are no l
-
I am having a problem installing Adobe Extension Manager 6.0.7 update. Received Error Code: U44M1P7. Help? Thank you for your assistences.
-
Back ground job scheduling in BDC
Hi , Can anybody explain about back groung job scheduling in BDC program.
-
AIR app randomly crashes on Mac, EXC_BAD_ACCESS (SIGBUS)
Hi there! A recently published AIR app of mine (compiled as .dmg) seems to crash randomly on Mac OS. First off, there is the app if anyone wants to try it: http://toki-woki.net/p/le-bon-coin-coin/ It's French, but you'll easily find where to click to
-
i was on this page: http://www.alumiiinium.com/about.html and was wondering how it is possible to make a tween between each of the objects. specifically, you click a button and it slides from object 1 to object 3, but if you go back to object 1 then