Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Flash




Help Unloading Swf File



Hi!I am trying to unLoad a swf file before I load another one but it is not working... mcl.unloadClip(arquivo);arquivo is my swf fileI want to unload it , make an animation and load it again..Here is the whole code:Code: var mcl:MovieClipLoader = new MovieClipLoader();var mclL:Object = new Object();mclL.onLoadProgress = function(target,loaded,total) {   loader.percent.text = Math.round((loaded/total) * 100) + "%";}mclL.onLoadInit = function() {   loader._visible = false;   loader.percent.text = "";}mcl.addListener(mclL);...btArtigos.onRelease = function(){   if(pagina != "artigos"){      pagina = "artigos";      mcl.unloadClip(arquivo);      arquivo = "artigos.swf";       var tQuadrox :Tween = new Tween(quadroMC,"_xscale",Strong.easeOut,95,0,0.5,true);       var tQuadroy :Tween = new Tween(quadroMC,"_yscale",Strong.easeOut,97,0,0.5,true);       tQuadrox.onMotionFinished = function(){           var tQuadrox :Tween = new Tween(quadroMC,"_xscale",Strong.easeOut,0,95,0.5,true);           var tQuadroy :Tween = new Tween(quadroMC,"_yscale",Strong.easeOut,0,97,0.5,true);          tQuadrox.onMotionFinished = function(){              mcl.loadClip(arquivo,palco);          }       }         }//do if}thank you!!



Actionscript 2.0
Posted on: Mon Aug 07, 2006 6:41 pm


View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread

Unloading An Xml File?
hi,
I am relativley new to AS3 so please bear with me. I am loading an xml file into a container to create a thumbnail gallery, and using the xmlList function to access the nodes. I would like to, upon a mouse_up event on a button, unload the current xml file and load a new one to create a new thumbnail gallery. I am unsure how to do this, and all of my attempts have resulted in fragments of the larger list being included in my gallery, along with the thumbnails of the most recently hit button. Is there a way to entirely remove an xml file from my project, or is there a different route that could easily remedy this? Thanks.

Unloading A SWF File..
I have spent days in the archives researching and trying to piece together a code that will unload a simple SWF file but I just don't get this code.

I have a button on the main stage with instance name: menbtn

This button loads a SWF file called menlayout and it also runs a movie clip that fades in a button that is on the main stage called unloadbtn.

The code I use to load the SWF file is this:

ActionScript Code:
menbtn.addEventListener(MouseEvent.CLICK, mencoinmc);
if (event.currentTarget.name == "menbtn")
{
var coinLayout:Loader = new Loader();
coinLayout.load(new URLRequest("menlayout.swf"));
addChild(coinLayout);
menbtn.useHandCursor = false;
menbtn.removeEventListener(MouseEvent.CLICK, mencoinmc);
}

The file loads great but I just need to get it unloaded.

Can someone please write the code for me?
Do I put the code in the actions on the main stage on in the SWF file?

I'm just not getting this unload command and it seems like a no-brainer..

tia
ks

Unloading XML File
Hello all,

I'm having problems loading a new XML file.
I have a single XML loading into an MC initially.
Then when I try to load in a new file with a button - the previously loaded XML file doesn't want to leave. Maybe it's just too happy where it is?


Code:
var imagelibrary = new XML();
imagelibrary.ignoreWhite = true;
imagelibrary.onLoad = function(success) {
if (success) {
gallery_mc.loadPic(0);
} else {
error_txt.text = "Error retrieving file.";
}
};
imagelibrary.load("imagelibrary.xml");
Here's me trying to load a new file.

Code:
button1.onRelease = function() {
imagelibrary.load("newXMLfile.xml");
}
I've tried removing the movie clip as well as deleting the xml... no luck.
When i remove the movie clip and try to load up a new file - the same file comes back!

Any ideas? Thanks a bunch!

Unloading A Swf File From A Level
Hey Pals,

I'm new here at Flash Kit and new at Flash MX 2004 Pro as well, and I'm in a real fix for my class project. I'm really hooked on Flash and plan to go along way with it, so I'm not just a casual user looking for quick out and waste your information.

I need to know how to unload a .swf file. The main pages (frames) of my Flash website are on the main timeline, but I want a .swf file to run as the user moves from one page (frame) to the next. I have it all set up, but I can't get the .swf to unload so that the user can use the buttons on the page (frame) beneath the .swf. I've tried unloadMovieNum, but to no avail as I'm probably using it incorrectly. Can a .swf file unload itself with unloadMovieNum on the final frame? I'm sure that sounds dumb to people who know.

Any help you have would be appreciated. I'm really looking to get connected in Flash and Actionscript society, so I'll be here for the long haul.

Thanks, Stu

Unloading An External .swf File?
Here is the code that I have:

var swfRequest:URLRequest = new URLRequest("show.swf");
var swfLoader:Loader = new Loader();
swfLoader.load(swfRequest);
addChild(swfLoader);

It's pretty simple. I have created a .fla file and imported another .swf file into it (just like loading an image). The problem that I have is that when I click onto another page (I am building an entire web site), the movie is still there.

How do I unload the movie when the page that it is on is clicked out of?

Unloading Xml File, Then Loading New
how do i unload an xml file and load a new file once something has been clicked.. im able to load the new xml, but it sits ontop of the one i want to unload.

Unloading An External File
i'm stuck...
i'm using external SWFs that load into my "container" layer when a button is pressed. these external SWFs will have a "close" button in them, and i want them to "unload" when the button is pressed. this is the code i'm using to load the movie, which works fine:

_root.container.loadMovie(_root.currMovie+".swf")

but how does one go about "unloading" a movie? how can i change this line of code to achieve this?

Unloading External SWF File
Hi all,
I've been a long-time lurker, first time poster. I have a master swf file which loads an external swf file ("Slideshow-main.swf") into an empty movie clip ("slideshow") when it reaches a certain point in the timeline.

The external file is called by this:


Code:
slideshow.loadMovie("Slideshow-main.swf");
and that works fine, the movie starts as expected. The problem comes when you navigate away from this frame in the master movie and come back to this slideshow. It appears that the previous loading of the movie is still running and overlaps with the new loading, thus creating a mish-mash of stuff. I have tried almost everything and can get the movie to unload using:


Code:
slideshow.unloadMovie();
However, when the movie starts back up it does the overlapping thing again. I have searched the forums and all over, but to no avail.

Thank you for any help!

Help Unloading External Swf File
stop();
var myRequest:URLRequest = new URLRequest("welcome.swf");
var myLoader:Loader = new Loader();
myLoader.load(myRequest);
myLoader.contentLoaderInfo.addEventListener(Event. OPEN,showPreloader);
myLoader.contentLoaderInfo.addEventListener(Progre ssEvent.PROGRESS,showProgress);
myLoader.contentLoaderInfo.addEventListener(Event. COMPLETE,showContent);
var myPreloaderreloader = new Preloader();
function showPreloader(event:Event):void {
addChild(myPreloader);
myPreloader.x = stage.stageWidth/2;
myPreloader.y = stage.stageHeight/2;
}
function showProgress(eventrogressEvent):void {
var percentLoaded:Number = event.bytesLoaded/event.bytesTotal;
myPreloader.loading_txt.text = "Loading - " + Math.round(percentLoaded * 100) + "%";
myPreloader.bar_mc.width = 198 * percentLoaded;
}
function showContent(event:Event):void {
removeChild(myPreloader);
addChild(myLoader);
}

logo.addEventListener(
MouseEvent.MOUSE_UP,
function(evt:MouseEvent):void {
gotoAndStop(1);
}
);

I've loaded external swf file, with a preloader in timeline 5.
I am trying to return to timeline 1 by clicking a button, but when i go back to time line 1,
the external file(welcome.swf) i loaded is appearing in timeline 1. How can I unload this?
I tried to insert myLoader.unload(); , but it isn't working. Please some one let me know
what I can do to make swf unload.

Unloading A External Txt File
i have made gallery that work like,when i rollover the thumb image ,it will show a big image in any side of thumb,it also load an exter txt file that contain description about image. if any one could help me to unload that taxt file,bcause it load but cant unload. my script is as following

for image rollover:----

on(rollOver)
{

var loader:MovieClipLoader = new MovieClipLoader();
this.createEmptyMovieClip("container",1);
loader.loadClip("Gold & Diamond Jewellery/GD Ring/GD Ring 177.jpg",container);

container._x=510;
container._y=130;
}
on(rollOut)
{
removeMovieClip("container");
}
on(release)
{
gotoAndPlay("11");
removeMovieClip("container");
}

for txt load:----
myData = new LoadVars();
myData.onLoad = function() {
myText_txt.html=true;
myText_txt.text = this.myVariable;
};
myData.load("anand.txt")

Unloading A Dynamic Text File
Hi! Is there a way to unload a dynamic text file? This is what I'm using to load it:

on (release) {
loadVariablesNum("about.txt", 0);
}

so I tried to use:

on (release) {
unloadVariablesNum("about.txt", 0);
}

on a different button to unload but it doesn't work. I was looking through all of the available actions and noticed that one wasn't there but is there something else that will unload it?

Loading .txt File And Unloading On A Timer
I'm looking to load a.txt file in a button click which I have covered. I'm looking to have it load for 30 seconds and then unload. How can I do this all from the button? Thanks - Chris

Finish Play Of Swf File Pre-unloading...
Hey boys and girls,

Have a quick question for you. A few weeks ago while browsing the tutorials I found one that showed how to let a movieclip complete its cycle before unloading. It worked so that when you mouseover the image it starts looping the cycle and then onmouseout it finishes the loop its in the process of doing before unloading...anyone know?

Thanks

~ Seretha


*New Edit* p.s. if it helps i believe the tutorial was taught using a circular button example with a pulsing outer blue layer...bring back any memories?.....

File Is Running Slowly After Unloading External Swf
I have a file that loads several external swfs when buttons are clicked. Then the swfs are unloaded when an exit button is clicked.

This is the code that removes the swfs:


Code:
function exitBtn(event:MouseEvent):void {
gotoAndPlay("reset");
stage.removeChild(loader);
}

exit_btn.addEventListener(MouseEvent.MOUSE_OVER, exitBtn);
This works fine except for one swf that when unloaded, causes the main file to suddenly run very slowly after this swf is unloaded.

The swf that is causing problems has the following AS2 code in it below.
Is there something in this code that is not being removed that is slowing down my main file?


Code:
import flash.display.BitmapData;

Mouse.hide();

// the displacement maps
var map1:BitmapData = new BitmapData(1086, 684, true, 0xFF000000);

//bmps hold the displacement maps bitmap
this.createEmptyMovieClip("bmp1", 10);
bmp1.attachBitmap(map1, 0, "auto", true);

// blur filter
var blur = new flash.filters.BlurFilter(8,8,4);

// displacementMapFilters
var mapPoint = new flash.geom.Point(0,0);
var dmfr = new flash.filters.DisplacementMapFilter(map1,mapPoint,1,1,-10,-10,"clamp",0,1);

// these contain the animated vector graphic which will be drawn to the displacement map
this.createEmptyMovieClip("cont1", 100);
cont1._visible = false;

// Apply blur filter to bmps which is used to fade out the displacement map
bmp1.filters = [blur];

bmp1._visible = false;

onMouseMove = function()
{
var d = cont1.getNextHighestDepth();
var mc1 = cont1.attachMovie("circle", "c"+d, d);
mc1._x = this._xmouse;
mc1._y = this._ymouse;
mc1.cacheAsBitmap = true;
};

monster.onEnterFrame = function()
{
map1.draw(cont1);
map1.draw(bmp1);
this.filters = [dmfr];
};
Any ideas? I'm still very new to Actionscript so any help is appreciated.

Thanks.

Loading And Unloading Movies Into Blank A .swf File
hey everyone!

this is my problem

at the moment my flash site http://www.xartwork.co.uk
is just one movie and is over 2MB!

so what i wanted to do is seperate each area topic in
to seperate movies
and load them into a blank .swf instead of just one movie.

my plan is to load the main movie first, where
all the links are on the right hand side,
and then load and then unload the movies
over the main movie.

However, i aint got a clue how to unload a movie so
that u can see the first main movie!

Moreover, i having problems loading another .swf movie
over the main movie, tried the _root. method but
aint working!

please help!

Unloading A Movie Clip When A File Loads Up?
When you open the file I dont want some movie clips to be visable until you click on the button to open then. When I put in the code and tested it; it worked but it opened windows explore where my file is saved. BUT when opening it in IE it worked fine no nothing. What I wanted to know is this code right?

unloadMovieNum(window._visible=false);

or am I missing something like on load??? :S

Unloading A Movie Clip When A File Loads Up?
When you open the file I dont want some movie clips to be visable until you click on the button to open then. When I put in the code and tested it; it worked but it opened windows explore where my file is saved. BUT when opening it in IE it worked fine no nothing. What I wanted to know is this code right?

unloadMovieNum(window._visible=false);

or am I missing something like on load??? :S

Unloading MCs
I can't figure out how to get the unload to work. The script is below for my button 'Info'. It loads the movie, but will not unload the one that is on the stage. These are MCs within MCs within MCs. There are piecs and placements within each MC, so as far as I can tell, they are all necessary.
The scripting below that (the setProperty() ) is what actually works (and I have obviously tried it without the setProp). So I can load the MC, and set the visibility to 0 when I want another MC on the stage, but cannot actually unload it. Am I doing something wrong? Or is this the only way to do it?

You can see this on my homepage: http://www.emotion7.com
Try clicking the 'Info' button, letting it load, then the
'Services' button to see what I mean.
Thanks.


on (release) {
loadMovie ("Information.swf", "_root.Text.TextInfo");
unloadMovie ("_root.Text.TextServices.Services.swf");
}
on (release) {
setProperty ("_root.Text.TextServices", _visible, FALSE);
setProperty ("_root.Abstract.Abstractcopy", _visible, FALSE);
}

Unloading Various
I've got about 11 different movies that are all loaded into different "emptyMovies" with variable names of container1, container2, container3, etc...

Is there a way that I can unload all these at the same time using the UnloadMovie action?

Thanks
ghjr

[][][][][][ <-- Unloading
is there any way of telling to unload whatever external swf is loaded into lets say, level 1?

Thanks in advance

Unloading Mc's
ok so I have got my images loaded up dynamically on my site, but they overlap each other. They are all being loaded into a container, but how do I tell them to replace one another, rather than layer?

http://www.markertphoto.com/flash.htm

Help Unloading A Swf Please
Hello everyone, im having problems closing/unloading a swf file loaded into an empty movie clip.
This script sets up the main movie components;
stop();
_root.createEmptyMovieClip("empty_scroll_mc", 10);
_root.empty_mc._x = 0;
_root.empty_mc._y = 0;
_root.empty_scroll_mc.loadMovie("scrolling_menu.sw f");
_root.createEmptyMovieClip("empty_mc", 1);
_root.empty_mc._x = 0;
_root.empty_mc._y = 0;
_root.empty_mc.loadMovie("pool_page.swf");
_root.createEmptyMovieClip("empty_popup_mc", 9);
_root.empty_popup_mc._x = 25;
_root.empty_popup_mc._y = 0;

The empty mc in question is the third one, empty_popup_mc.

The above script sets up the navigation and the stage.
'empty_mc' is the empty movie clip into which my main content pages (different swf's) are loaded into, depending on which button is clicked on the scrolling_menu.swf

ie; this is attatched to a button on the scrolling_menu.swf:
on (release) {
_root.empty_mc.loadMovie("gym_page.swf");
}

This loads the gym_page.swf, into the empty_mc i then have a button on the gym_page which loads the brochure_request.swf in the emty_popup_mc

on (release) {
_root.empty_popup_mc.loadMovie("brochure_request.s wf");
}

We now get to my main question, the button to unload the brochure_request.swf from the empty_popup_mc is on the brochure_request.swf

Hope that makes sense to you! I thought i had sussed paths but i im stumped on this one.
Can anyone help me write the script for the button that will unload the brochure_request.swf from the empty_popup_mc.

the site is here
The brochure request page can be found by clicking on the gym page, then the button on the right that says 'more details'
Thank you so much, this is the first time i have tried to unload something !

Unloading .flv
I have a main .swf file that loads another .swf file which contains a .flv video using the Media Playback component. Works great. Only problem is that, when I close the loaded .swf file containing the .flv, the audio still plays.... The entire screen goe's away, but the audio still remains. I've tried many differenct solutions on unloading certain things to no avail. any ideas? is there an unload .flv command? or maybe some kind of buffering issue? Thanks for any tips.

MX 2004 Pro.

Help With Unloading....
hey

i have a button in main.swf which loads a swf called 'morpher' into a target mc called 'morphLoad'. the code used is:


loadMovie("videos/morpher.swf", "morphLoad");


the movie plays fine but what i want it to do when it is over is to unload and then target a frame within main swf called 'goagain'

im guessin the code would go in the last frame of the loaded 'morpher' swf?

any help on how to achieve this would be very appreciated.

thanks alot,
james

SWF Unloading
Hi guys
i got a problem unloading a .swf, i have a long timeline with all the pages in it,at a certain frame i have loaded, a form.swf with loadmovienum and it works, but my prob is when i then go to other pages on the same time line the swf is still there in background i have tried unloadmovienum at the end of the page frame but then the movie does not load. i have no hair left please help,ooop 1 hair left sorry.

Unloading
Hi there

I was wondering if somebody would help me.I am trying to create a porfolio of my work to apply to uni.They need to see developmental work so i have created the "develpmental work" button as a movie clip.Once clicked on it will play and the rough sketches will be shown.I'm not to sure what the script woud be to unload the main timeline piece so that only the sketch is shown.

I will attach the file.It only works for the six piece along.
Thank you so much
Nadine

I don't know why it is not letting me upload the file

[F8] Help With Unloading
Ok I'll try and keep this simple I have a movieclip which randomly duplicates itself somewhere on the x value between 1 and 396, above the stage it then decends downwards using a separate movieclip that I have set up which runs though a series of frames moving the moviclip down 2px every frame, When it reaches the bottom of the screen I have a hit area covering the bottom of the stage, when it hits this I would like it to unload.

Plz Help.

[F8] Nut Unloading
Let me start by saying thank you in advance.

I have my main time line and on it I have an MC with an instance name of "skip_intro".

Inside that MC I have a button with the following AS:
on (release) {
_root.gotoAndStop("end");
_root.o_text.gotoAndStop("end");
_root.skip_intro.unloadMovie();
}

The problem is my "unloadMovie" isn't working.

Basically I want it so that when you click on the "button (MC "skip_intro"), it disappears off the stage. Why is my AS not working? I also tried:
this.unloadMovie();

Interestingly enough when you click it a second time it disappears... but I need it to work on the first click.

What am I doing wrong?

Again,

Thanks

Unloading
Basically I followed along with a tutorial about how to create a memory game in flash. The only issue I have is that I want to be able to unload the game once the user progresses past that part of my flash. I have tried fooling around with a couple unload functions and clear functions but I don't think I'm recognizing which variable/movie I need to have unloaded for the cards to actually go away!

A simple forceclear function to remove all actionscrpit would be very handy!

here's the code that is loaded into the frame...


Code:

Code:
// Gamefield settings

// EDIT HERE
card_w = 70;
card_h = 90;
card_wdistance = 17;
card_hdistance = 15;

// STOP EDIT
card_dw = card_w + card_wdistance;
card_dh = card_h + card_hdistance;
row_card = Math.floor((Stage.width - card_wdistance) / card_dw);
col_card = Math.floor((Stage.height - card_hdistance) / card_dh);
n_card = col_card * row_card % 2 == 0 ? col_card * row_card : (col_card - 1) * row_card;
imgs_n = n_card / 2;

// CENTER THE IMAGE IN THE CARD
centerImage = function(target){
target.front._visible = false
target.front.container._x -= target.front.container._width / 2
target.front.container._y -= target.front.container._height / 2
}
// ---------------------------------------------

empty = new Array();
function createCard(n, w, h) {
empty.push(n);
this.createEmptyMovieClip('card' + n, n);
with (this['card' + n]) {
lineStyle(0, 0x000000, 100);
beginFill(0x000099, 60);
moveTo(w / 2, 0);
lineTo(w / 2, h / 2);
lineTo(-w / 2, h / 2);
lineTo(-w / 2, -h / 2);
lineTo(w / 2, -h / 2);
lineTo(w / 2, 0);
endFill();
createEmptyMovieClip('front', 1);
front.createEmptyMovieClip('container', 2);
front.createEmptyMovieClip('backgr', 1);
with (front.backgr) {
moveTo(-w / 2, -h / 2);
lineStyle(0, 0x000000, 0);
beginFill(0x333333, 100);
lineTo(w / 2, -h / 2);
lineTo(w / 2, h / 2);
lineTo(-w / 2, h / 2);
lineTo(-w / 2, -h / 2);
endFill();
}
front.onEnterFrame = function() {
tot = this.container.getBytesTotal();
car = this.container.getBytesLoaded();
if (tot == car && tot > 200) {
this._parent._parent.centerImage(this._parent);
delete this.onEnterFrame;
}
};
}
}
selcards = [];
function placeImages() {
act_img = 0;
for (img = 0; img < imgs_n; img++) {
for (k = 0; k < 2; k++) {
act = Math.round(Math.random() * (empty.length - 1));
this['card' + empty[act]].img_id = act_img;
this['card' + empty[act]].front.container.loadMovie("imgs/img" + act_img + ".jpg");
this['card' + empty[act]].onRelease = function() {
this.rotateCard(0, 0);
this.enabled = false;
MovieClip.prototype.enabled = false;
};
empty.splice(act, 1);
}
act_img++;
}
}
MovieClip.prototype.rotateCard = function(v, i) {
this.operazione = v == 0 ? +0.1 : -0.1;
this.incremento = i == 0 ? 100 : 10;
selcards.push(this._name);
this.onEnterFrame = function() {
this.incremento += this.operazione;
this._xscale = (100 * Math.sin(this.incremento));
if (this._xscale > 0) {
this.front._visible = v == 1 ? false : true;
}
if (this._xscale >= 99) {
delete this.onEnterFrame;
selcards.length < 2 ? MovieClip.prototype.enabled = true : null;
v == 0 && selcards.length > 1 ? checkCards() : null;
}
};
};
function generateGameField(cards, distance, hdistance) {
Ypos = card_h / 2 + hdistance;
Xpos = card_w / 2 + distance;
for (c = 0; c < cards; c++) {
createCard(c, card_w, card_h);
if (c % row_card == 0 && c > 0) {
Ypos += this['card' + c]._height + hdistance;
Xpos = card_w / 2 + distance;
}
this['card' + c]._x = Xpos;
this['card' + c]._y = Ypos;
Xpos += this['card' + c]._width + distance;
}
placeImages();
}
generateGameField(n_card, card_wdistance, card_hdistance);

score = 0;
this.createTextField('punti', -1, 500, 380, 0, 0);
punti.autoSize = true;
punti.text = 0;
function checkCards() {
if (this[selcards[0]].img_id == this[selcards[1]].img_id) {
score++;
punti.text = score;
eval(selcards[0])._visible = eval(selcards[1])._visible = false;
} else {
eval(selcards[0]).rotateCard(1, 1);
eval(selcards[1]).rotateCard(1, 1);
eval(selcards[0]).enabled = eval(selcards[1]).enabled = true;
}
selcards = [];
MovieClip.prototype.enabled = true;
}

stop();
I don't really care how, but I need to find out any way to completely unload this game.... I'm pulling my hair out over this because it's probably so simple.

Maybe encapsulating all the code into an object and unloading the object? I don't understand much actionscript but I am an experienced coder..

SWF Unloading Bug.
Hey,

There's this unloading bug in as3 i've come upon. If i load a SWF i can't get the memory back in any way (that i've found atleast).

I've attached an example of the issue on the adobe bug list (here), but i was hoping anyone has come upon any workaround for it in any way.

So, if anyone've seen anything please give a shout out here!

Thanks!

/bob

Help Unloading .swf
I'd been running searches all over Google all day today, but to no avail.

So I've created a gallery for my portfolio. The main splash page is an swf, and from within, it calls my graphic design, illustration, sculpture and motion art portfolios(which are also .swf files). The graphic design and sculpture portfolios load fine, but in order to return to the main page I need to unload whichever video is presently on top or active. Here is an example of the Graphic design clip as it is loaded.



ActionScript Code:
stop();

var GDloaded_clip:Loader = new Loader();

stage.addChild(GDloaded_clip);
GDloaded_clip.contentLoaderInfo.addEventListener( Event.INIT, handleInitGD);
GDloaded_clip.load( new URLRequest( "GD_Gallery.swf" ) );


function handleInitGD(evt:Event):void
    {
    var extMovie:* = GDloaded_clip.content;
    extMovie.x = 13;
    extMovie.y = 92;
    }

Here is my logo button, which returns to the home page.


ActionScript Code:
Logo.addEventListener(MouseEvent.CLICK, clickLogo);
function clickLogo(event:Event):void
{
   
    GDloaded_clip.parent.removeChild(GDloaded_clip);
    SCloaded_clip.parent.removeChild(SCloaded_clip);
    gotoAndStop("Home");
}

I only have 2 galleries created at the moment(Sculpture-SCloaded_Clip and Graphic Design- GDloaded_clip) but I would like to iron out the current problem. Right now if i click the logo to return from a gallery, i get the following error because there is nothing loaded for it to unload (i think)

Error #1009: Cannot access a property or method of a null object reference.

I have no real useful knowledge of actionscript, and most of what I have done has been through tutorials and modifications of code. I think I need to write an if() statement to check and see what is currently loaded. Once I can figure this out I can modify it for the rest of the site. Any help would be very appreciated.

-Aelx

Help Unloading .swf
I can't figure this out, I think i'm trying to remove the child to early. anyways, heres my code without any attempt to remove the child. thank you very much people at actionscript!


ActionScript Code:
stop();
about.buttonMode = true;
contact.buttonMode = true;
portfolio.buttonMode = true;

var request:Loader = new Loader();

about.addEventListener(MouseEvent.ROLL_OVER, overAbout);
about.addEventListener(MouseEvent.ROLL_OUT, outAbout);
about.addEventListener(MouseEvent.MOUSE_DOWN, downAbout);
function overAbout(MouseEvent):void{
    about.gotoAndPlay(2);
}
function outAbout(MouseEvent):void{
    about.gotoAndStop(1);
}
function downAbout(MouseEvent):void{
   
var request:Loader = new Loader();
request.load(new URLRequest ("AboutMe.swf"));
request.x = 0;
request.y = 0;
addChild(request)
gotoAndStop(2);

}



portfolio.addEventListener(MouseEvent.ROLL_OVER, overPortfolio);
portfolio.addEventListener(MouseEvent.ROLL_OUT, outPortfolio);
portfolio.addEventListener(MouseEvent.MOUSE_DOWN, downPortfolio);

function downPortfolio(MouseEvent):void{

        var request:Loader = new Loader();
        request.load(new URLRequest ("Portfolio.swf"));
        request.x = 0;
        request.y = 0;
        addChild(request)
    gotoAndStop(2);
}

function overPortfolio(MouseEvent):void{
    portfolio.gotoAndPlay(2);
}
function outPortfolio(MouseEvent):void{
    portfolio.gotoAndStop(1);
}

contact.addEventListener(MouseEvent.ROLL_OVER, overContact);
contact.addEventListener(MouseEvent.ROLL_OUT, outContact);
contact.addEventListener(MouseEvent.MOUSE_DOWN, downContact);

function downContact(MouseEvent):void{
var request:Loader = new Loader();
request.load(new URLRequest ("Contact.swf"));
request.x = 0;
request.y = 40;
addChild(request)
gotoAndStop(2);
}

function overContact(MouseEvent):void{
    contact.gotoAndPlay(2);
}
function outContact(MouseEvent):void{
    contact.gotoAndStop(1);
}

Help With Unloading .swf
I'm close to the effect I want, but I can't get the some of the stuff to unload when clicking to different area's throughout the project, (.swf's). On the main page, it's going to be identical to the rest of the site except for a few different elements, how do I get the .swf's your currently on to disapear so it doesn't go into the rest of the .swf area's, ie: new's/annoucements, etc.

you can preview what I'm asking for at our site, http://www.edni.net/site/

The news/annoucements doesn't dispear when clicking to different sections. can someone help me out, I'd greatly appreciate it.

Unloading FLV's Help
hello. here is my situation:

please read on, i tried to make it and easy read...

i have a 2 buttons that have this code on them:

on (release) {
stopAllSounds();
unloadMovieNum("50.swf", 50)
unloadMovieNum("50.swf", 51)
loadMovieNum("

Should I Be Unloading Mcs?
Hello,

I have an online test in Flash. It is basically working ok, but it is not reliable 100% of the time. The movie has 6 sections, the first 4 use quite a few audio files. I preload all of the audio (external mcs) in the beginning of the movie, while the user is reading an instruction page. I have a preloader to do this. Some problems that are occurring:

Occasionally, the preloader stops at a percentage and will not load any more. Doesn't seem to happen very often.
Sometimes, when the user gets to section 5 of 6, for example, there are no images displayed. It has also frozen at the beginning of other sections. Yet it works fine for 90% of the other people. It's almost as if all of the data did not get preloaded correctly.

I am wondering why there is this inconsistent behavior with the same movie? One thing is I do not 'unload' any of the mc's I preload. As a general rule of thumb, should one be unloading mc's as soon as they are no longer needed in the movie?

I decided to preload all of the audio files at the beginning because once the test starts, I did not want the user to have to wait to load data. Is this a bad idea? Perhaps I should be loading at the start of each section? Would that make it play more reliably.

Any suggestions would be much appreciated!

Unloading AS3
I have loaded an external movieclip into another on the stage. I would like to have a button that is in the loaded movie clip that unloads that loaded swf. Problem is that I cant have Mouse event listener on that button to call a function on the main stage. My guess is having to use event Dispatcher but not sure how to implement it.

What would be the best way to do this?





























Edited: 11/15/2007 at 11:46:04 AM by arandlett

Unloading Flv's
Hello.

I have a home page that loads several flv's. I am also trying to give the user the ability to view the page without video. When the user clicks a button on the home page, it sets a cookie that reloads the page with a different swf file that does not contain any flv's. However, since it takes a second or two for the cookie to be read, the initial swf has started loading, and even though the entire swf is swapped out with the "video-less" swf, those original flv's continue to load in the background, slowing everything down even though the user wants no part of the video. Any ideas how to solve this?

fyi, another feature of the home page shares a similar problem. The user is to select one of 3 "personal assistants" who will be their guide through the rest of the site. Once they've selected, another cookie is set. Each time they return, the initial swf checks for a cookie, and then displays a static image of the character they have selected. At this point, I am also trying to "unload" all of the swfs, but they still load in the background. I have tried both "unloadMovie(movieName);" and "stream_ns.Clear();".

the site may be seen here:

First Entertainment Credit Union »

Thanks in advance!

Unloading Flv's
Hello.

I have a home page that loads several flv's. I am also trying to give the user the ability to view the page without video. When the user clicks a button on the home page, it sets a cookie that reloads the page with a different swf file that does not contain any flv's. However, since it takes a second or two for the cookie to be read, the initial swf has started loading, and even though the entire swf is swapped out with the "video-less" swf, those original flv's continue to load in the background, slowing everything down even though the user wants no part of the video. Any ideas how to solve this?

fyi, another feature of the home page shares a similar problem. The user is to select one of 3 "personal assistants" who will be their guide through the rest of the site. Once they've selected, another cookie is set. Each time they return, the initial swf checks for a cookie, and then displays a static image of the character they have selected. At this point, I am also trying to "unload" all of the swfs, but they still load in the background. I have tried both "unloadMovie(movieName);" and "stream_ns.Clear();".

the site may be seen here:

First Entertainment Credit Union »

Thanks in advance!

Unloading A SWF
I have a Menu swf file that I load another swf file with the following code stright from the help file:

var request:URLRequest = new URLRequest("riskTaking.swf");
var loader:Loader = new Loader()
loader.load(request);
addChild(loader);

This works fine but now I need to remove this SWF file when the user clicks on a Main Menu button in the loaded SWF file. I can't see any linkage to the Main SWF in the debugger. Any suggestions?

Thanks ahead of time.

UNLOADING SWF
Can anyone offer any advice on how to unload swfs that have been loaded into a host SWF.


For eaxmple i have my main movie and am loading an external swf into it
this works fine however when i try to close it with another button in the main movie,
I get this error message

TypeError: Error #1034: Type Coercion failed: cannot convert flash.display::MovieClip@2cf8101 to flash.display.Loader.
at VirtualSynthPiano_fla::MainTimeline/unloadFunction()

This is my code

//button in the main movie that loads the external swf
keyboardDragMC.btBtnMC.addEventListener(MouseEvent .MOUSE_DOWN, loadPlayer);

function loadPlayer(myevent:MouseEvent):void {
var myrequest:URLRequest=new URLRequest("organBluesPlayer.swf");
var myloader:Loader=new Loader();
myloader.addEventListener("UnloadMe", unloadFunction);
myloader.load(myrequest);
stage.addChild(myloader);
}

//button in main movie that should unload the swf
keyboardDragMC.editBtnMC.addEventListener(MouseEve nt.MOUSE_DOWN, unloadFunction);
function unloadFunction(event:Event):void {

Loader(event.currentTarget).unload();
}


After looking around the net this seems to be quite a common problem. Would much appreciate any advice any one could offer?

thanks

Liam.

Unloading A SWF
I'm using a shell to load a series of swf files. I'm using a next and a back button to move from swf to swf. Some of my swf files contain video which continues to play. Is there a command to dump the current swf that can be invoked when I press the next or back buttons of the shell? Thanks

Unloading A Swf
hello all. this is probably a piece of cake, but i cant seem to get it right. i want to be able to close a swf from within another swf. iwant to be able to do this:

www.murderdolls.com

go to media... click on a photo thumbnail... the larger image contains a "close window" button.

how do i "close window"?

thanks in advance!

Unloading .flv
I have a main .swf file that loads another .swf file which contains a .flv video using the Media Playback component. Works great. Only problem is that, when I close the loaded .swf file containing the .flv, the audio still plays.... The entire screen goe's away, but the audio still remains. I've tried many differenct solutions on unloading certain things to no avail. any ideas? is there an unload .flv command? or maybe some kind of buffering issue? Thanks for any tips.

Unloading XML
I was hoping someone could tell me how to unload xml correctly. I need to unload an xml file on release of a button, then load new XML. Currently I am unLoading the initial xml by unLoading the target clip. However, when I do this not all of the assets (jpgs) that where loaded with the xml delete form the screen. The following is the code I am currently using. Any help would be great. Thanks.

interactivePortfolio_btn.onRelease = function() {
portfolioLabel_txt.text = "Interactive Portfolio";
currentThumb_mc.unloadMovie()
portfolio_xml.load("XML/interactive.xml");
_parent.description_txt.text = "";
_parent.info_txt.text = "";
play();
};

Help With UNLOADING
I can't seem to get the main.swf to unload when the next swf loads up...after clicking on the button...


Code:
on (release) {
_root.content.loadMovie("portfolio.swf",0);
unloadMovie("flashsite.swf")
}
I'll take any help...thanx!

Unloading A Swf
hi,
i want unload (close completely) an intro section when i click on a button to naviagate to another section. The intro section is a separate swf file and i when the button is pressed to proceed to the next section, it opens an external swf file.

I have tried a few unload movie codes that i have found here, but the intro screen still flicks up for about a second when buttons are pressed to go to other sections.

Any help would be much appreciated, thanks!

Unloading A .swf
So here goes,

This is on my main timeline (below), as you can see it is calling individual _mc to play depending on what btn you choose (pretty straight forward). Each _mc has a stop(); at frame 2 and 10 (except buttonHandler(1) 'cause I want it to load automatically). The buttonHandler(4) is just loading a .swf, on frame 2; loadMovie("brugmansia_gallery.swf",1000); and on frame 11 unloadMovie("brugmansia_gallery.swf");

I'm using the kirupa gallery with xml and thumbnails, I don't if that makes a difference

var btnNum;
function buttonHandler(who:Number){
if(btnNum==who)return;
_root.container_mc["menu"+btnNum+"_mc"].play();
_root.container_mc["menu"+who+"_mc"].play();
btnNum=who;
}
_root.buttons_mc.home_btn.onRelease = function(){
_root.buttonHandler(1);
}
_root.buttons_mc.portfolio_btn.onRelease = function(){
_root.buttonHandler(2);
}
_root.buttons_mc.favorites_btn.onRelease = function(){
_root.buttonHandler(3);
}
_root.buttons_mc.merchandises_btn.onRelease = function(){
_root.buttonHandler(4);
}
_root.buttons_mc.contact_btn.onRelease = function(){
_root.buttonHandler(5);
}
_root.buttonHandler(1);

My question is how do i get the .swf to leave when you click on a different button?

Unloading
I`m really sorry if this has been covered, but the search doesn`t come up with much when I type "Unload" in!

Ok, here`s my problem:

I have 9 frames on the main timeline - Each frame is a separate page for a website. eg:

Frame 1: Home
Frame 2: News
etc


In my second frame I have External SWFs being loaded in when you push 1 of 4 buttons. Now, I placed all of these on _Level1 so that each time a button is pressed, it unloads the previous movie before the new one. Hassle free......or so I thought.....

Now every time I move to another frame on the main timeline (ie any other frame apart from 2) the movie last loaded on that page stays over the other frames, as it`s on _level1.

I`ve tried using an UnloadMovieNum () code (to unload all movies in _level1) on all the other frames, but I`m not having any luck. Perhaps I`m doing it wrong? I've only been using Flash a few months!

Any ideas?

Thanks very much for your time!

~STEVE

Help With Unloading
Code:
/the name of the button is "but". Name your buttons f.e. but1,but2 and etc in the movieclip properties.
button.onRollOver = function() {
this.gotoAndStop(1);
this.play();
if (this._currentframe == 13) {
flipOut = true;
stop();
}
};
button.onRollOut = function() {
if (flipOut=true) {
this.gotoAndPlay(14);
}
flipOut = false;
};
button2.onRollOver = function() {
this.gotoAndStop(1);
this.play();
if (this._currentframe == 13) {
flipOut = true;
stop();
}
};
button2.onRollOut = function() {
if (flipOut=true) {
this.gotoAndPlay(14);
}
flipOut = false;
};
button3.onRollOver = function() {
this.gotoAndStop(1);
this.play();
if (this._currentframe == 13) {
flipOut = true;
stop();
}
};
button3.onRollOut = function() {
if (flipOut=true) {
this.gotoAndPlay(14);
}
flipOut = false;
};
button4.onRollOver = function() {
this.gotoAndStop(1);
this.play();
if (this._currentframe == 13) {
flipOut = true;
stop();
}
};
button4.onRollOut = function() {
if (flipOut=true) {
this.gotoAndPlay(14);
}
flipOut = false;
};
button5.onRollOver = function() {
this.gotoAndStop(1);
this.play();
if (this._currentframe == 13) {
flipOut = true;
stop();
}
};
button5.onRollOut = function() {
if (flipOut=true) {
this.gotoAndPlay(14);
}
flipOut = false;
};
button6.onRollOver = function() {
this.gotoAndStop(1);
this.play();
if (this._currentframe == 13) {
flipOut = true;
stop();
}
};
button6.onRollOut = function() {
if (flipOut=true) {
this.gotoAndPlay(14);
}
flipOut = false;
};
button7.onRollOver = function() {
if (flipOut=true) {
this.gotoAndPlay(14);
}
flipOut = false;
};
button.onRelease = function() { unloadMovieNum(1); main.gotoAndPlay(39); }
button2.onRelease = function() {
my_mc.loadClip("shape.swf", "container");
};
var empty = this.createEmptyMovieClip("container", "100");
empty._x = 0;
empty._y = 0;
my_mc = new MovieClipLoader();
-----------------------------------------------------------------
WHAT DO I PUT TO UNLOAD??? the loaded movieclip?
-----------------------------------------------------------------
button3.onRelease = function() { unloadMovieNum(1);main.gotoAndPlay(260); }
button4.onRelease = function() { unloadMovieNum(1);main.gotoAndPlay(109); }
button5.onRelease = function() { unloadMovieNum(1);main.gotoAndPlay(321); }
button6.onRelease = function() { unloadMovieNum(1);main.gotoAndPlay(405); }

Copyright © 2005-08 www.BigResource.com, All rights reserved