ActionScript 3.0 :: Child SWF Close / Unload Itself

Nov 14, 2009

Experience: I'm a newbie to AS3 - making the transition from AS2. Problem: I have a parent SWF into which I load a child SWF. I want to have a close button in the Child SWF (not the parent!) which closes/unloads it from the parent swf. Been looking all over but can't find any solutions that work. Here's my code for loading the child SWF from the parent's timeline:

var myrequest:URLRequest=new URLRequest("child.swf");
var myloader:Loader = new Loader();
myloader.load(myrequest);
myloader.contentLoaderInfo.addEventListener(Event. COMPLETE, movieLoaded);
[Code]...

What should I put in the child SWF to unload itself? Apologies if this presumably simple task has been covered, please point me to the thread.

View 5 Replies


Similar Posts:


IDE :: Child SWF Close/unload Itself?

Nov 14, 2009

I have a parent SWF into which I load a child SWF. I want to have a close button in the Child SWF (not the parent!) which closes/unloads it from the parent swf. Been looking all over but can't find any solutions that work.Here's my code for loading the child SWF from the parent's timeline:

var myrequest:URLRequest=new URLRequest("child.swf");
var myloader:Loader = new Loader();
myloader.load(myrequest);[code]...

What should I put in the child SWF to unload itself?

View 11 Replies

ActionScript 3.0 :: Unload Loader / Remove Child / Close Button

Oct 16, 2011

i successfully managed to work out the loader script, and load a external swf file into my current project. Now that its working and all is well, i realised that only way to get back to 'main menu' was to close the whole thing. I tried to sort it out with a simple 'back' button but no success there. As mentioned in the title thats the options i found so far but cant seem to quite understand them tbh. I just want it to work so that I easily can manouvre back to 'main menu'.

View 2 Replies

ActionScript 3.0 :: Multiple Buttons To Open Child Swfs Then Be Able To Close The Child From Within The Child?

Mar 25, 2009

I have a picture on the stage that has multiple items that have hotspots/links over them that should open a child swf on top of the background and show details about the items. then have a button in the child swf itself that removes the child from over the background so the user can click on another item etc.I found this code in someone's post and I am trying to modify it so that works for multiple swf files...it currently works for a single swf.I wan to pass the name of the button in front of the .swf in the URLRequest to have the same name as the instance name of the referring button. But I can't figure it out. Here is the code I am using on the stage

View 2 Replies

ActionScript 3.0 :: Difference Between Close() And Unload()

Nov 5, 2009

I'm having a bit of trouble undestanding the difference between close and unload. Do I have this right? loader.close() stops the current load in progress by disconnecting the data stream between the URLRequest to the LoaderInfo object - so calling the load() method again in the future reopens this connection and continues downloading the file where it left off

loader.unload() stops the current load in progress if called before complete, removes the LoaderInfo object from the Loader - so calling the load() method in the future creates a new LoaderInfo object and starts a whole new download - if other objects have references to the removed LoaderInfo object it won't be deleted

View 4 Replies

ActionScript 2.0 :: Code Does Not Work After Using The Close Button To Unload The Movie?

May 21, 2007

i have a movie called with:

Code:

_root.attachMovie("biography", "biography", _root.mylogo.getDepth()-1, {_x:Stage.width/2, _y:Stage.height/2});
and within each i have a close button with:

Code:

close_bt.onPress = function() {
unloadMovie(_root.biography);
};

but now i have a problem, im trying to use:

Code:

if (!_root.biography) {
_root.attachMovie("biography", "biography", _root.mylogo.getDepth()-1, {_x:Stage.width/2, _y:Stage.height/2});
}

to call the move again if there isnt already an instance of it but it only works the first time the movie was called, it wont work after i use the close button to unload the movie..

View 6 Replies

ActionScript 3.0 :: Close Button - DisplayObject Must Be Child Of Caller

May 8, 2010

I'm receiving this as an output error, when trying to use a "close button" I created for a lightbox that tweens in after the user clicks all_1thumb:
ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.
at flash.display::DisplayObjectContainer/removeChild()
at testportfolio_fla::All_mc_2/closePop().

The lightbox populates with the correct image but the close button doesn't. Here is the entire script:
import fl.transitions.Tween;import fl.transitions.easing.*;
//Portfolio SubnavArt_btn.addEventListener(MouseEvent.CLICK, goViewAll);
function goViewAll(event:MouseEvent){
(this.parent as MovieClip).gotoAndStop("Art")}
[Code] .....

View 1 Replies

Actionscript 3.0 :: Unload A Child From Within Itself?

Jun 26, 2009

Im trying to solve this, it should be quite simple but yet I can't get it to work! I have an index.swf that has a container which holds the entire flash site. I want to unload and load the various sections (different swf files) by clicking buttons thar are WITHIN THE CHILD.

[Code]...

View 2 Replies

ActionScript 3.0 :: Unloading A Loaded External SWF With A Close Button On The External SWF To Unload?

Aug 15, 2011

[URL]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);
}

[code]....

View 10 Replies

ActionScript 3.0 :: Different Ways To Unload Child?

Oct 14, 2010

I have a stage w/ 6 buttons that call movie clips. works to remove them when the "next" button is clicked. Now I need to have an additional option of clicking outside the buttons "on the backround" to remove the movie clips also.

PHP Code:
var fadeInstance:DisplayObject = null;
function openFade(fade:MovieClip, y:Number):void{

[code].....

View 4 Replies

ActionScript 3.0 :: Unload Child Swf Code?

Jan 29, 2010

I have one page in my Flash site that has photo thumbnails that load external swfs. The code works OK, but when I use

Code:
removeChild(loader);
in my button functions for other pages, I'm getting the output error:ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.at flash.display:isplayObjectContainer/removeChild()
at the_fla::MainTimeline/homeClick() Is there a way to fix the error?

View 6 Replies

ActionScript 3.0 :: Unload External SWF From A Child?

Nov 25, 2009

I have a button that loads an external movie onto the stage:

Code:
magnalock.addEventListener(MouseEvent.CLICK, magnalock_newvid);
function magnalock_newvid(event:MouseEvent) {
trace("you clicked me");

[Code]....

View 3 Replies

ActionScript 3.0 :: Unload Parent Swf From Child Swf?

Jan 5, 2011

Parent swf has a button to load Child swf and Child swf has a button to unload itself through a dispatchEvent. Both in respective document classes. Parent loads Child fine... Child can't remove itself! Anyone have an idea what I am doing wrong here? Or another way to go about this? Struggling for a day now...

Parent swf:

public var myLoader:Loader;
loadButton.addEventListener(MouseEvent.CLICK, loadSWF)
public function loadSWF(e:MouseEvent):void {

[Code]....

View 2 Replies

ActionScript 3.0 :: Unload Child After A Load Request

Nov 4, 2009

I have a drop down box that is loading in different movies when selected.  But when I select the second option in the drop down box, the movie gets loaded on top of the next movie. I saw that there is a removeChild(), but i'm having trouble finding where to apply it in the code below? If I put it in the function, it creates errors of course.[cod]e....

View 3 Replies

ActionScript 3 :: Unload Child SWF On Last Frame Without Using Button

Nov 6, 2010

Using AS3. I have in my code a button to stop and remove the swf, but I would like to have in addition to unload a child swf when it plays it's last frame automatically - not using a button.

Here is my code on the main timeline:
var loader:Loader;
var closer:close;
norton_btn.addEventListener(MouseEvent.CLICK, NortonDemo);
function NortonDemo(e:MouseEvent):void {
[Code] .....

Now, what do I need to add or change to this code and add to the code on the last frame of NortonDemo to accomplish what I want to do?

View 1 Replies

ActionScript 2.0 :: Unload Child MovieClip After Its Playback?

May 12, 2010

I don't know AS2 well, prefering 3.0, however the project should be in 2.0. So, I have 2 movieclips, one is parent, another - loaded through LoadMovie("name.swf", _root);I need to unload child after its played and stoped. How can I do it in most proper way?

View 1 Replies

ActionScript 2.0 :: Unload Movie On Root From Child?

Oct 5, 2011

I'm loading a movie in externally. The external movie has a button to unload itself from the main movie. It loads into _root.calContainer. The button is called xButton. This is the script that's not working:

_this.xButton.onRelease = function() {
_global.calContainer.unloadMovie;
}

I've also tried. _root.calContainer to no avail.

View 1 Replies

ActionScript 2.0 :: Unload Child Movie On Enter Frame?

Sep 7, 2007

I am attempting to build a site using load movie commands. I have a navigation movie with 4 buttons, on the press of each button I uesd this script.

[code]...

this loads an animation and plays into the news reader. on the press of a button to go back I have loaded a seperate back animation using this script

[code]...

The problem I now have is I want to remove this clip at the end of the animation and return to the root navigation.

View 1 Replies

ActionScript 3.0 :: Unload From Child And Navigate To Frame Label In Parent SWF

Sep 16, 2010

I have a flash page where I am loading another .swf into. With a button in the loaded swf I need to unload the loaded swf (where the button is) and navigate to a specific frame label in the parent .swf. I've tried to do the following in the key frame where the swf get loaded into I've put the following:

var gallery_load_wonderland:Loader = new Loader();
gallery_load_wonderland.contentLoaderInfo.addEventListener(ProgressEve nt.PROGRESS, loop_wonderland);
gallery_load_wonderland.contentLoaderInfo.addEventListener(Event.COMPL ETE, done_wonderland);
gallery_load_wonderland.load(new URLRequest("gallery_wonderland.swf"));
function loop_wonderland(e:ProgressEvent):void {
[Code] .....

I basically want to first load the swf called "gallery_wonderland.swf". Then in the "gallery_wonderland.swf" there's a button called "contact03_btn"¯ which I want to unload "gallery_wonderland.swf" even though it's inside the swf and navigate to the frame label called "Contact" in the parent swf.
 
What can I do I've done similar before and it works, but when I do it know and I click the contact03_btn it comes with following error message:
TypeError: Error #1034: Type Coercion failed: cannot convert flash.display::Stage@26215ba1 to flash.display.MovieClip.
at gallery_wonderland_fla::MainTimeline/back_wonderland()[gallery_wonder land_fla.MainTimeline::frame1:227]

View 13 Replies

ActionScript 3.0 :: Child Requesting Parent To Unload External Content

Jun 19, 2011

If you haven't met me yet, that's because I'm pretty new around here. I picked up ActionScript just earlier this week, actually. Name's Kate. Nice to meet you. All righty. I'll start by saying that I've been referencing this thread:

actionscript.org/forums/showthread.php3?t=222486
(I'm not allowed to post URLs until I've got at least 50 posts in?! Gasp.)

View 2 Replies

ActionScript 1/2 :: Unload Parent Movie After OnloadInit Of Child Movie?

Jul 30, 2010

I am loading external swf's into a main load.swf, using a Moviecliploader object. What I basically want to do is that, after an external movie, say home.swf, loads another external swf, say about.swf, home.swf should be unloaded.
 
home.swf is loading about.swf into the _root.mc_holder, which is placed inside load.swf. I want all external files to be placed within this holder. Now this is working with some files, but not with others. My standard code within all files is this:
 
//code within home.swf to load about.swf
var loader:MovieClipLoader = new MovieClipLoader();var ldrlistener = new Object();loader.addListener(ldrlistener);ldrlistener.onLoadStart =

[Code]......

View 3 Replies

ActionScript 2.0 :: Close Browser By Clicking On Close Button Embedded Swf?

Jul 27, 2009

i want to close browser by clicking on close button embedded swf. I have tried fscommand("quit"), but which is not working on browser.

View 9 Replies

ActionScript 2.0 :: Unload/Load Movie Clips In Parent Movie From Buttons In Child Movie?

Feb 12, 2009

I Have 3 Movies:MAIN.SWF, contains loading movie actions for Nav.swf and Home.swf.NAV.SWF, contains navagation menu loaded on Level 2 in Main HOME.SWF, contains slideshow for home page loaded on Level 1 in Main In NAV.SWF, there is a MOVIE CLIP "graphmc", which contains a BUTTON "graphicbtn", When this button is clicked, I'd like the HOME.SWF (which is loaded into Main.swf on Level 1) to fade out and unload, and load and fade in Graphics.SWF in place of it.

View 6 Replies

ActionScript 2.0 :: Unload Movie Stuff - Current Swf To Unload And The New One To Load Only After A Transition Occurs

Jun 16, 2003

I want the current swf to unload and the new one to load only after a transition occurs. Is there a more efficient way to do this than if. switch()?

View 2 Replies

ActionScript 3.0 :: Unload The Previous Loaded .swf And Load The New .swf Without Having A Separate Button To Unload

Aug 9, 2008

I am working on a school project that requires me to load external .swf or .jpg files. I currently have all of the buttons working and are loading an external .swf file on to the screen. The problem I am having is that when I go from one button to the next the loaded .swf stays on the screen and the next .swf gets loaded on top of it. I know that I need to unload the file but I am not sure where to put the code for the unload or what code exactly to use. I would like when the button is pressed to unload the previous loaded .swf and load the new .swf without having a separate button to unload.

[Code]...

View 3 Replies

ActionScript 3.0 :: Unload Not Unloading - Unload An External SWF On _root To Load A New One Instead

Jul 23, 2009

I'm trying to unload an external SWF on _root to load a new one instead. I've tried (almost) everything but can't figure it out... I get this error : "Error #1010: A term is undefined and has no properties."

[Code]....

View 3 Replies

ActionScript 2.0 :: Put A Close Button In The Window MC To Close The Window?

Mar 23, 2007

*let say i have a mc called A. it can call a MC with an instance name called window_btn.window can be drag and double click.i want to put a close button in the window MC to close the window.

how to call the close button in the MC?

View 14 Replies

Flex :: SWFLoader - Child Apps Couldn't Access Certain Objects That Were Instantiated By Another Child App?

Aug 23, 2010

i have problem with swfLoader in flex, when i close following code in click method i can easly add many swf to main application

<mx:VBox id="content" width="100%" height="100%" ></mx:VBox>
public function doIT():void
{[code]....

when i close adding those swfs in loop i have the same error, it looks like child apps couldn't access certain objects that were instantiated by another child app, so what can i do?

View 1 Replies

ActionScript 3.0 :: Can't Swap Child For New Class Instance IF Child Is Exported For Action Script?

Aug 18, 2010

I have a movieClip with one frame on the timeline containing one child whose instance name is "myContent"I am using this function to swap "myContent" with any number of possible class instances.

Code:
function setContentAsClass(c:Class)
{

[code].....

View 2 Replies

ActionScript 3.0 :: Flash Selecting A Specific Child By Mouseclick, Turning Off A Child Within All Non Selected?

Mar 19, 2011

I've used this site as a resource leading up to this, not particularly sure if I worded this correctly I have a class "Block" which is just a square (will be something else later on in the process) I want each block to have controls to add an additional block in either direction so I have another class BlockButtons which has my buttons for each direction.

And another class GlobalVar where I keep all my variables for funsies

[Code]...

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved