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




Loading Swf On-top Of Exisiting Swf (then Unloading Previous Swf)?



Hi

I'm currently building a site with 1 main file, and 4 swfs loading into a Empty Movie container within the main file. An example of the code I'm using (on buttons) to do this is


Code:
on (release) {
loadMovie("Reels.swf", "_root.container");
This works fine, but instead of just replacing the existing swf with the new one, I'm trying to create a transistion where the new loaded swf covers over the exisiting one. I have added a fade/wipe to the start of each external swf, but because they are all loading into the same movie container on the same level, I'm not getting the effect I'm after.
I'm still learning AS, is it possible to load an external swf into the movie container on the next level (to the exisiting one), then after a short time unload the swf in the previous level? As I say, I in the process of learning flash/AS, so any advice is greatly received, even pointing in the direction of a tutorial to learn.

Thanks
Wayne



KirupaForum > Flash > ActionScript 1.0/2.0
Posted on: 05-09-2007, 07:12 PM


View Complete Forum Thread with Replies

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

[F8] Loading On-top Of Exisiting Swf (then Unloading Previous Swf)?
Hi

I'm currently building a site with 1 main file, and 4 swfs loading into a Empty Movie container within the main file. An example of the code I'm using (on buttons) to do this is

Code:
on (release) {
loadMovie("Reels.swf", "_root.container");
This works fine, but instead of just replacing the existing swf with the new one, I'm trying to create a transistion where the new loaded swf covers over the exisiting one. I have added a fade/wipe to the start of each external swf, but because they are all loading into the same movie container on the same level, I'm not getting the effect I'm after.
I'm still learning AS, is it possible to load an external swf into the movie container on the next level (to the exisiting one), then after a short time unload the swf in the previous level? As I say, I in the process of learning flash/AS, so any advice is greatly received, even pointing in the direction of a tutorial to learn.

Thanks
Wayne

Loading On-top Of Exisiting Swf (then Unloading Previous Swf)?
Hi

I'm currently building a site with 1 main file, and 4 swfs loading into a Empty Movie container within the main file. An example of the code I'm using (on buttons) to do this is

on (release) {
loadMovie("Reels.swf", "_root.container");

This works fine, but instead of just replacing the existing swf with the new one, I'm trying to create a transistion where the new loaded swf covers over the exisiting one. I have added a fade/wipe to the start of each external swf, but because they are all loading into the same movie container on the same level, I'm not getting the effect I'm after.
I'm still learning AS, is it possible to load an external swf into the movie container on the next level (to the exisiting one), then after a short time unload the swf in the previous level? As I say, I in the process of learning flash/AS, so any advice is greatly received, even pointing in the direction of a tutorial to learn.

Thanks
Wayne

Loading Swf On-top Of Exisiting Swf (then Unloading Previous Swf)?
Hi

I'm currently building a site with 1 main file, and 4 swfs loading into a Empty Movie container within the main file. An example of the code I'm using (on buttons) to do this is


Code:
on (release) {
loadMovie("Reels.swf", "_root.container");
This works fine, but instead of just replacing the existing swf with the new one, I'm trying to create a transistion where the new loaded swf covers over the exisiting one. I have added a fade/wipe to the start of each external swf, but because they are all loading into the same movie container on the same level, I'm not getting the effect I'm after.
I'm still learning AS, is it possible to load an external swf into the movie container on the next level (to the exisiting one), then after a short time unload the swf in the previous level? As I say, I in the process of learning flash/AS, so any advice is greatly received, even pointing in the direction of a tutorial to learn.

Thanks
Wayne

Loading On-top Of Existing Swf (then Unloading Previous Swf)?
Hi

I'm currently building a site with 1 main file, and 4 swfs loading into a Empty Movie container within the main file. An example of the code I'm using (on buttons) to do this is

Code:
on (release) {
loadMovie("Reels.swf", "_root.container");
This works fine, but instead of just replacing the existing swf with the new one, I'm trying to create a transistion where the new loaded swf covers over the exisiting one. I have added a fade/wipe to the start of each external swf, but because they are all loading into the same movie container on the same level, I'm not getting the effect I'm after.
I'm still learning AS, is it possible to load an external swf into the movie container on the next level (to the exisiting one), then after a short time unload the swf in the previous level? As I say, I in the process of learning flash/AS, so any advice is greatly received, even pointing in the direction of a tutorial to learn.

Thanks
Wayne

Unloading Previous Frame / Component
I'm loading in some pictures from the xml file with some script. And I wanted to unload it at the next few frames cause its lagging. How can I do that?

ActionScript Code:
import com.unic8.media.Scaena;

var mySlideShow:Scaena = new Scaena();
mySlideShow.load(this, "slide1.xml", "effects.xml");

Unloading Previous Frame / Component
I'm loading in some pictures from the xml file with some script. And I wanted to unload it at the next few frames cause its lagging. How can I do that?
ActionScript Code:
import com.unic8.media.Scaena;

var mySlideShow:Scaena = new Scaena();
mySlideShow.load(this, "slide1.xml", "effects.xml");

AS3 - Unloading Previous Frame Functions
Last edited by youwh : 2008-09-01 at 19:59.
























I'm loading in some pictures from the xml file with some script. And I wanted to unload it at the next few frames cause its lagging. How can I do that?


ActionScript Code:
import com.unic8.media.Scaena;
 
var mySlideShow:Scaena = new Scaena();
mySlideShow.load(this, "slide1.xml", "effects.xml");

Replace Exisiting Files
When i try to add a movie clip from one animation to another it asks do i want to replace existing items or not, when i do some of my original things change, when i dont loads of random things from my library come up. ive been working on it for ages ive run out of ideas of what i could do to make it work.

Is there a way of putting the whole of one flash file in another?

Thanks

Opening Exisiting Flash Movies
Hi,
I am new to macromedia flash and have inherited a website with both html and flash pages. I have tried to open the exisiting flash movies in Macromedia Flash 2004 and so far have not been able to. It seems that the swl files are protected. Can someone help me? Also how do the notepads work in Flash 2004? Thanks for any response!

Loading An New Swf And Uloading The Previous
Hey everybody. I'm new at actionscript 3.0, and I'm sorry if this question has already been answered, but I've checked some similar threads, and haven't found anything that could help me.

I saw a lot of people asking how they could load external swf files into the main swf file and then unload them, but this isn't what I'm looking for.

I have a main swf, which is a menu, and in that menu I have a button that, if clicked, brings another swf file on top of the menu. But what I want is for the menu to disappear completely and leave me alone with the swf file I just opened. I created a loader and then added a child, etc.. Then when I activate the loader, it loads the external swf... but I know that the menu is still there, because if I erase the background on the external swf, i can still see it underneath. So, in short, what I'm asking is.. is there a way to open an external swf and close the original at the same time?

Many thanks in advance to anyone willing to give a hand ;-)

UnLoad Previous .swf Before Loading New .swf
I'm using the "Full Flash Site" Tutorial, and and trying to get the SWF files to fade in and out when they load, so that it isn't so jumpy. I have gotten them to fade in properly, however, when I click the bottons to load the next .swf the old one disappears immediatly, and the new one fades in, causing an equally unattractive problem.

This Script appears on the black mc:


ActionScript Code:
onClipEvent(load) {    {    dir = 0;    speed = 6;    _alpha = 0;    }        this.dir = 1;}onClipEvent(unload) {        this.dir = -1;}onClipEvent(enterFrame){        var temp1 = this._alpha + speed*dir;        this._alpha = Math.min(100,Math.max(temp1,00));}


Thanks in advance.

Loading External Swf Over Each Previous One...
hi i have like 7 pages, and i have each one, i want the new one, (whichever button you choose (swf loading)) to load over the existing swf... beacus i dont want there to be a pause in the pages, i want the new one to load up, and sotp on the first frame, over the current swf, then start the loading, and unload the swf that was previous.

so like if each swf is named "page" i want it to be like on press for button load "page" then when the new one starts, on clip event unload movie num (page) but i want each "page" to load over the current one... heheh understand? thanks...

UnLoad Previous .swf Before Loading New .swf
I'm using the "Full Flash Site" Tutorial, and and trying to get the SWF files to fade in and out when they load, so that it isn't so jumpy. I have gotten them to fade in properly, however, when I click the bottons to load the next .swf the old one disappears immediatly, and the new one fades in, causing an equally unattractive problem.

This Script appears on the black mc:


ActionScript Code:
onClipEvent(load) {    {    dir = 0;    speed = 6;    _alpha = 0;    }        this.dir = 1;}onClipEvent(unload) {        this.dir = -1;}onClipEvent(enterFrame){        var temp1 = this._alpha + speed*dir;        this._alpha = Math.min(100,Math.max(temp1,00));}


Thanks in advance.

So Lost Need To Position A Movie Within An Exisiting File
I have a presentation on Monday and I've been stuck on one last problem.

I created a flash file. Like a slide show. On one of the keyframes I loaded an external swf file. It's a demo that I need to load, but only for that one page.

I was able to load the movie using this
code that took me forever to find because I'm so bad at flash:

loadMovieNum("first bank scene.swf",1);

now my problems are this.

I can't figure out how to place this movie at different x and y coordinates. Right now it just plays at the top of my screen and cuts off other parts of the pre-exsisting slide that it's placed in.

My other problem is that the swf file is playing past the screen size. Is there someway I can apply a mask to the swf file in action script? Or do I need to apply the mask to the original flash file before I export it and import it again into my presentation?

I'm so useless. Please help.

Adding Easing Tween -- To Exisiting Function
Adding Easing Tween -- to exisiting function

Ok so I found this nice code over at Prototype. Its a function for Aligning to stage on Resize. http://proto.layer51.com/d.aspx?f=1514

It works really nice on its own but I was hoping to add some tweened easing as an additional optional parameter. (I posted there twice asking for help to no avail =( So I am asking here at Kirupa, hoping someone can help me with my struggles. What I wish to add is - implementing and adding an "easing" function as part of the current function. Something generalized to be called only if desired and the ability to set the ease type, duration, maybe prop etc.. (or whatever needed to make it work )

I have tried all kinds of things and below is as close as I can come (at least the only thing I can do to get the thing to move, although as you will see it works backwards and I can only get it to work using stage.width, stage.height, however I have tried newX oldX and all kinds of other things and cant seem to get things to move.

I am missing something, perhaps everything


Code:
// Original Script found here --
// Functions: Align to stage on Resize -- http://proto.layer51.com/d.aspx?f=1514

// +++ Stage Align +++
// onR function is used with fullscreen & "T(op)L(eft)" Stage.align as a ref point!!!
//fscommand( "fullscreen", true ); // <<-- Optional if needed

import mx.transitions.Tween;
import mx.transitions.easing.*;
Stage.scaleMode = "noScale";
Stage.align = "TL";

// Optional Easing -- I am trying to add with no success =(

function mover(obj:MovieClip, startX:Number, startY:Number, endX:Number, endY:Number) {
var tweenX:Tween = new Tween(obj, "_x", Regular.easeInOut, startX, endX, 1, true);
var tweenY:Tween = new Tween(obj, "_y", Regular.easeInOut, startY, endY, 1, true);
}

// trigger alignment via Stage listener object!
// alignment options: "TL", "TR", "TC", "BL", "BR", "BC", "CL", "CR", "CC"
// optional offset by X or Y axis provided as an object property: obj.X, obj.Y

function onR(A, obj) {
var F = String(A).substring(0, 1);
var L = String(A).substring(1, 2);
(obj.X == undefined) ? obj.X=0 : obj.X=obj.X;
(obj.Y == undefined) ? obj.Y=0 : obj.Y=obj.Y;
if (F == "T") {
obj._y = Math.ceil(obj.Y);
} else if (F == "B") {
obj._y = Math.ceil(Stage.height-obj._height-obj.Y);
} else if (F == "C") {
obj._y = Math.ceil((Stage.height-obj._height)/2-obj.Y);
}
if (L == "L") {
obj._x = Math.ceil(obj.X);
} else if (L == "R") {
obj._x = Math.ceil(Stage.width-obj._width-obj.X);
} else if (L == "C") {
obj._x = Math.ceil((Stage.width-obj._width)/2-obj.X);
}
}
//Usage
// ... later
// -- OPTIONAL positioning - to add further positioning of items if needed

mc_1.X = 100;
// X offset for mc_1 used for Center Left alignment
mc_2.Y = -50;

// Y offset for mc_2 used for Center Right alignment

var resizeListener:Object = new Object();
resizeListener.onResize = function() {
onR("CL", mc_1);
onR("CR", mc_2);

// Optional Easing Call to mover function -- I am trying to add with no success =(
// I know its set to stage center now but with all my efforts, this is the only senerio
// I can get anything to move, I tried newX old X etc.. this. and on and on.. can
// someone be so kind to help me add an "optional" workable easing function to this
// script? Mucho Apreciato to anyone that does ;-)

mover(mc_1, mc_1._x, mc_1._y, Math.round(Stage.width/2), Math.round(Stage.height/2));
mover(mc_2, mc_2._x, mc_2._y, Math.round(Stage.width/2), Math.round(Stage.height/2));
};
Stage.addListener(resizeListener);

// also the 2 mcs have registration in upper left etc..


I am open to suggestions on implementation, I just thought this function from prototype was pretty slick really and wanted to add some easing to it. It should be possible, I just cant get my head wrapped around it.

Can anyone please provide some help? I really appreciate your input people Thanks for your help.
__________

Simplify What I am asking:

http://proto.layer51.com/d.aspx?f=1514

Add easing to the above function found at that link (also posted above) on browser resize, so any MCs using the align function ease to there new location instead of just snapping into place.

Thanks everyone

Adding Easing Tween -- To Exisiting Function
Adding Easing Tween -- to exisiting function

Ok so I found this nice code over at Prototype. Its a function for Aligning to stage on Resize.
http://proto.layer51.com/d.aspx?f=1514

It works really nice on its own but I was hoping to add some tweened easing as an additional optional parameter. (I posted there twice asking for help to no avail =( So I am asking here at GTAL, hoping someone can help me with my struggles. What I wish to add is - implementing and adding an "easing" function as part of the current function. Something generalized to be called only if desired and the ability to set the ease type, duration, maybe prop etc.. (or whatever needed to make it work :( )

I have tried all kinds of things and below is as close as I can come (at least the only thing I can do to get the thing to move, although as you will see it works backwards and I can only get it to work using stage.width, stage.height, however I have tried newX oldX and all kinds of other things and cant seem to get things to move.

I am missing something, perhaps everything :D

Code:

// Original Script found here --
// Functions: Align to stage on Resize -- http://proto.layer51.com/d.aspx?f=1514

// +++ Stage Align +++
// onR function is used with fullscreen & "T(op)L(eft)" Stage.align as a ref point!!!
//fscommand( "fullscreen", true ); // <<-- Optional if needed

import mx.transitions.Tween;
import mx.transitions.easing.*;
Stage.scaleMode = "noScale";
Stage.align = "TL";

// Optional Easing -- I am trying to add with no success =(

function mover(obj:MovieClip, startX:Number, startY:Number, endX:Number, endY:Number) {
   var tweenX:Tween = new Tween(obj, "_x", Regular.easeInOut, startX, endX, 1, true);
   var tweenY:Tween = new Tween(obj, "_y", Regular.easeInOut, startY, endY, 1, true);
}

// trigger alignment via Stage listener object!
// alignment options: "TL", "TR", "TC", "BL", "BR", "BC", "CL", "CR", "CC"
// optional offset by X or Y axis provided as an object property: obj.X, obj.Y

function onR(A, obj) {
   var F = String(A).substring(0, 1);
   var L = String(A).substring(1, 2);
   (obj.X == undefined) ? obj.X=0 : obj.X=obj.X;
   (obj.Y == undefined) ? obj.Y=0 : obj.Y=obj.Y;
   if (F == "T") {
      obj._y = Math.ceil(obj.Y);
   } else if (F == "B") {
      obj._y = Math.ceil(Stage.height-obj._height-obj.Y);
   } else if (F == "C") {
      obj._y = Math.ceil((Stage.height-obj._height)/2-obj.Y);
   }
   if (L == "L") {
      obj._x = Math.ceil(obj.X);
   } else if (L == "R") {
      obj._x = Math.ceil(Stage.width-obj._width-obj.X);
   } else if (L == "C") {
      obj._x = Math.ceil((Stage.width-obj._width)/2-obj.X);
   }
}
//Usage
// ... later
// -- OPTIONAL positioning - to add further positioning of items if needed

mc_1.X = 100;
// X offset for mc_1 used for Center Left alignment
mc_2.Y = -50;

// Y offset for mc_2 used for Center Right alignment

var resizeListener:Object = new Object();
resizeListener.onResize = function() {
   onR("CL", mc_1);
   onR("CR", mc_2);

// Optional Easing Call to mover function -- I am trying to add with no success =(
// I know its set to stage center now but with all my efforts, this is the only senerio
// I can get anything to move, I tried newX old X etc.. this. and on and on.. can
// someone be so kind to help me add an "optional" workable easing function to this
// script? Mucho Apreciato to anyone that does ;-)

   mover(mc_1, mc_1._x, mc_1._y, Math.round(Stage.width/2), Math.round(Stage.height/2));
   mover(mc_2, mc_2._x, mc_2._y, Math.round(Stage.width/2), Math.round(Stage.height/2));
};
Stage.addListener(resizeListener);

// also the mcs have reg in upper left etc...

I am open to suggestions on implementation, I just thought this function from prototype was pretty slick really and wanted to add some easing to it. It should be possible, I just cant get my head wrapped around it. :?

Can anyone please provide some help? I really appreciate your input people Thanks for your help :)

Disabling Previous Page When Loading A New
When i load a new swf file on top of a previous file, the buttons on the previous page are still active and you can click on them. you can't see them, but the little hand appears as if there is a button there. how do i disable the previous pages buttons when i load in a new one?

Loading Next And Previous SWFs Into A SWF Container
Hi

I have up until now been using scenes or very large single swf file for movies, however I have been looking at using the unload swf function but to say I am a little confused is an under statment... Prehaps if I state my needs someone could give me some help or point me to a helpful tutorial or example that has already been done!!...

I have a top level SWF that has a graphical 'TV' Screen and two buttons, Next and Previous. I have 9 other swf files that need loading in 3 ways:

1. Automatic .. First plays then when end of swf1 is reached then swf2 plays.. so on and so on..

2. Press the Next button which loads in the 'next' swf

3. Previous Button that loads the 'previous' swf..

I have found a couple of examples that do bits of this but Im sure there must be something out there that hits everything and probably stuff I havent thought of...

Any help much apprieciated..

Steve

[F8] Problem With Loading MC Into A Previous Loaded MC
hello guys!
I was like wondering maybe you can help me out here because i have this problem with actionscript and i've tried over and over again to solve it but still... .
So...

I have a swf (A.swf) and into it ....i load the "B.swf" ....that works fine ....but when i try to load something into the "B.swf" Ie pic1.jpg i can see the loaded content only in "B.swf". In A.swf it doesn't appear...doe the "B.swf" is still there.

Is like a nested loading system. and it doesn't work
Any help?

Loading Xml Data With Previous/next Buttons
hey everyone,

i'm trying to seperate some xml data into seperate pages. six entries on each page with three rows and two columns. i got the data to go into two columns...now i'm just trying to set up the next and previous buttons as well as showing only six entries per page.

i looked all over online but had no luck. any help would be greatly appreciated!

source and xml file attached.

Loading Swf In Container Over Other Swf Unloads Previous Swf?
okaay.. here is my doubt...

I have a main swf, which has the header of the website on top and buttons to navigate at the bottom. In the middle I have a container_mc where I load the swf's triggered by the bottom buttons.
Let's say, for simplicity sake, that I have 5 buttons - A, B, C, D and E, which load the A.swf, B.swf, C.swf, D.swf and E.swf files into the container.

My initial thought was that if I have A.swf loaded, and I click on B, that B.swf would load over A.swf, clearing A.swf from the website.
I am starting to think that is not so.
Note: I have no command to unload A.swf when I call B.swf. (because I assumed it was eliminated when a new swf was loaded)

The reason I think it isn't unloaded is because of 2 strange behaviors:

Strange behavior 1-
A.swf has a photo slideshow. I set the fade interval between the slides for 2.5 seconds. If I call B.swf, then call A.swf back again, the interval is smaller. If I repeat the above, the interval almost disappears.. I have the feeling it is loading one slideshow over the same slideshow...
This is the code:

Code:
//-----------OLD TV SLIDE PHOTO DISPLAY------------------------------

//: CALL IMPORT
import flash.display.BitmapData;

//: SETUP VARIABLES
var maxTVval = 4;// max number of fotos
var oldTVvar1 = 0;// keep track of previous random number
var oldTVvar2 = 0;// keep track of previous random number
var oldTVvar3 = 0;// keep track of previous random number
var newTVvar = 0;// used to load the next image
var si = 0;// interval variable

//: LOAD THE NEXT IMAGE
function getImage() {
newTVvar = Math.floor(Math.random() * maxTVval);// get random number
if (newTVvar == oldTVvar1 || newTVvar == oldTVvar2 || newTVvar == oldTVvar3) {// if number = old number..
getImage();// get a number
} else {// else
oldTVvar3 = oldTVvar2; // set old to new number
oldTVvar2 = oldTVvar1; // set old to new number
oldTVvar1 = newTVvar; // set old to new number
var linkageId:String = ("video" + newTVvar + ".jpg");// load the next image
var myBitmapData:BitmapData = BitmapData.loadBitmap(linkageId);// get image from library
TVpicscontainer_mc.attachBitmap(myBitmapData, this.getNextHighestDepth());// attach image to container

TVpicscontainer_mc._alpha = 0;// set its alpha to 0
TVpicscontainer_mc.onEnterFrame = fadeIn;// start fading out
delete this.onEnterFrame;// delete loop
}
}

//: FADE IN THE CURRENT MOVIECLIP
function fadeIn () {
if (this._alpha <= 100) {// if the movieclips alpha is greater than 0
this._alpha += 5;// reduce alpha by 5
} else {// else
this._alpha = 100;// reduce alpha to 0
delete this.onEnterFrame;// delete handler
si = setInterval(fadeOut, 2500);// after 2.5 seconds, fade out the movieclip
}
}

//: FADE OUT THE CURRENT MOVIECLIP
function fadeOut () {
clearInterval(si);// clear the interval variable
TVpicscontainer_mc.onEnterFrame = function() {// create loop to fade out
if (this._alpha >= 0) {// if the movieclips alpha is greater than 0
this._alpha -= 5;// reduce alpha by 5
} else {// else
this._alpha = 0;// reduce alpha to 0
delete this.onEnterFrame;// delete handler
getImage();// load the next image
}
}
}

// load first image
getImage();

//-----------END OF MAIN SLIDE video DISPLAY---------------------------\
Strange behavior 2 -
I have a toggle button, in the format of a flag, toggling the language chosen by the website visitor. The default is english (UK flag), but the visitor can choose portuguese (BR flag) in any of the swf files. The choice is stored in a global variable called _global.txtLanguage, and whenever visitor chooses a new swf by clicking on A, B, C, D or E the new swf has a onEnterFrame function to check what language is in the global variable and sends the flag_mc to the appropriate frame, displaying the alternative language flag on the toggle button. The problem is that when the swf file is called a second time only the defauld flag is displayed. A mouseover changes it correctly showing that _global.txtLanguage is correct. The feeling is that the onEnterFrame doesn't run except on the first time the swf is called. All subsequent calls do not trigger it.
This is the code:

Code:
//----------------Set Flag button-------------------------------

onEnterFrame = function () { // when movie is called, do this function
if (_global.txtLanguage != "port") {// check if language is different than portuguese
flag_mc.gotoAndStop("br_flag");// if yes, goto and stop on the brazilian flag of the flag_mc movie
delete this.onEnterFrame;// stop the onEnterFrame
} else {
flag_mc.gotoAndStop("uk_flag");// if no, goto and stop on the british flag of the flag_mc movie
delete this.onEnterFrame;// stop the onEnterFrame
}
}
So the questions that baffle me:
1) Why does the slideshow alter the fade interval upon reloads?
2) Why doesn't the toggle button run the onEnterFrame upon reloads?
3) Do I need to unload swf files before calling new swf files? What would be the proper code to do that ?

Any enlightment on my doubts are bound to receive my eternal gratitude
Best regards

Loading External Movies Via Next/previous Buttons
Hello all-

I'm about to program out a piece where I have a PDA with next and previous buttons on it where it will load 7 external movies to play in the screen area. I'm not sure about the correct approach on building this out in such a way so that the next/previous buttons call up the correct external movies.

I've looked up different approaches to using arrays as well as different nav button suggestions. Any help or guidance will be greatly appreciated.

Need To Create New Array, Taking A Few Random Entries From Exisiting Arrary... How?
Hello

I have a 2d array:

qTeeth[1] = [How many teeth do we have?, 1-10, 11-20, 21-30]
etc.

I now just want to extract 3 or so of these entries randomly, and create a new array with them.

Does anyone know a good tidy script to do this with??


Thanks in advance,
Ben.

Loading And Unloading ASP
Hey, folks.

Here's the deal -

I've got a .swf that sits at the top of an html website. The .swf contains sound - and a nifty on/off toggle button to turn said annoying sound on or off.

Unfortunately, the .swf is not in its own frame - so every time a link is clicked, the .swf is reloaded.

I'm DESPERATELY trying to pass a 'sound' variable from the .swf (eg. sound == "on") into asp.

THIS seems to be working - because I can see the sound=on (for example) tag in the url when the page reloads, and when I view the source of the .asp document.

Now... how in tarnation do I get Flash to load the value from the ASP? It's clearly not doing that. It's in the query string - it's in the url - hell, when I view the source, the value in the ASP is changing.

How do I succesfully load the value 'sound' from the ASP into Flash?


stop ();
if (_level0.sound != "off") {
tellTarget ("sound_toggle") {
gotoAndStop (2);
}
} else {
tellTarget ("sound_toggle") {
gotoAndStop (3);
}
}

I know how to load values from, say, a text file - does it work the same way, especially given that the ASP is continually being changed by the Flash?


Does anyone have ANY idea how to save seven professional developers from insanity?

Thanks, folks!

- Thingee

Loading & Unloading....
Hi All,

i am loading a few external swf's into some container MC's on the stage...they are loaded from a nav bar...they all sit in exactly the same position...

when i click the services button a 680X330 movie loads to coordinates X=0Y=0

when i click the contactus button a 680X330 movie loads to coordinates X=0Y=0

and so on..

they pretty much lie on top of each other...


Q:________________________________________________ _
Do i need to unload these swf before i load another and...if so..how do i do that

Cheers

Loading And Unloading SWF
Hi...everybody
i have 1 problem, i am having a main movie in that movie i load a swf file on click of a button, and it loads that swf file, now when that loaded swf work is over i unload it but now when i return to my main movie i want it to go to a particular frame and not to the start of the frame.

Pls can ne body help me?

Loading And Unloading....
Is there any reason why this code, the script for a button on a swf loaded on Level 1, shouldn't take me back to a frame on Level 0? I can't figure out what I'm doing wrong!!

on (release) {
unloadMovieNum (1);
_level0.gotoAndPlay("storyone");
}

Please help...

Thanks

Loading And Unloading Swf's
Does anyone know how to unload and then load a swf into a cell in dreamweaver i'm a little stuck someone suggested using dreamweaver anchors to label the cell and then target that from flash, But my actionscript knowledge is a bit poor. Can anyone help??
Thanks

Loading And Unloading
hi,

I have created an auto running presentation.
The flow is as follows:-

The main file: "main.swf". I am calling "a.swf" from the last frame of "main.swf".

Now after the animation in the "a.swf" file is over, I am loading "b.swf" and unloading "a.swf". (using the same level - "2").

The image on the lst frame of "a.swf" is the image on the first frame of "b.swf".

But the problem is that there is a very prominent jerk on load of "b.swf" (it looks as if there is a blank frame in between, whereas there is no such frame).

Please can anybody tell me how to remove this jerk or how to avoid it?

Thanks
swapna

Loading And Unloading A.s.a.p
hello friends i was trying to find out it there a way to load and unload a external movie clip with the same button. im trying to figure out when someone click on my button on my site and it goes to another page that's part of my site it loads on top of the main page and you can still see part of the other page how can i fix that. thanx

Loading And Unloading
I have a long verticle movie clip (Main), made up of four smaller movie clips (sub-Main).

To move between the sections I have this code

curSection = 0;
mySections.onEnterFrame = function() {
this._y -= (this._y-_root.curSection)*1;
};

and my buttons say:

on(press) {_root.curSection = 0;
}
and
on(press) {_root.curSection = -400;
}
etc . . .

In each of the sub-Main movie clips I have an empty movie clip with an instance name. This allows me to load an external .swf file. I use:
this.loadMovie("external.swf");

What I want to do is have these movies load ONLY when they are visible on the stage. That means they must unload too. I am having a problem with it. Any suggestions?

-shotbot

Loading And Unloading Swf's
Hello,

I am new to flash, but have built my first website using flash.

It seems to load and unload swf files well in explorer, but in netscape and safari it seems to stall or not work. It's strange how it works flawlessly in the Flash application and it seems buggy in different browsers. The website: http://cvdesignweb.com/

I think the problem is in how I load and unload swf files. Here is an expample of my scripts. Is there and easier way to do this, other than listing every possible movie to unload? Should I unload swf's before I load anything?

Thanks!

loadMovieNum("portfolio.swf", 30);

unloadMovieNum(10);
unloadMovieNum(20);

unloadMovieNum(40);
unloadMovieNum(50);
unloadMovieNum(60);
unloadMovieNum(70);
unloadMovieNum(80);
unloadMovieNum(90);
unloadMovieNum(100);

Loading/Unloading
I have a large .swf that needs a preloader to load. Now when I go to other .swf files should I load them? OR tell it to go to a html file?

I want to be efficient so that the user doesn't have to load the huge main page over again. I'm just confused on whats the best way to go from one flash page to the next.

Unloading A Swf And Loading It Again
I'm trying to do something that has turned out to be tougher than I thought it would be.

Basically, I've got a parent clip that creates an empty movie clip and then, using MovieClipLoader, loads an external swf into the child clip. The child clip then uses a setInterval function to periodically check a database and see if it has been updated and thus needs to be reloaded. If reload = true, then the interval should be cleared, the movieclip should be removed and the app should go back to the beginning of the parent clip and create an empty movieclip again and reload the swf again.

Everything works up to a point - when the external swf is called, the interval isn't cleared and then when then when the new updated swf is loaded, it will just skip over several frames (going, for example, from frame 2 to frame 16) causing all sorts of havoc. When the swf is loaded for the first time, it always runs perfectly.

My main theory about why this is happening is that I'm not _really_ removing the movieclip, even though I think I am. Here's how I create the clip and load the swf:


PHP Code:



var applicationSWF:MovieClip = _root.createEmptyMovieClip("applicationSWF", 2);
applicationSWF._lockroot = true;
var myMCL = new ssMovieClipLoader();
myMCL.loadClip(vDirectoryPath + vSwfConfig + "?"  + (new Date()).getTime(),"applicationSWF");




and here's how I'm clearing the interval and removing the clip from the child clip:

PHP Code:



if (lastUpdate < vSWFUpdateDate) {
    clearInterval(swfTimeoutID);
    this._parent.mcExit.gotoAndStop(1);
    this._alpha = 0;
    this._parent.loadingBar._alpha = 100;
    this._parent.gotoAndPlay(1);
    //this.unLoadClip();  //took this out because I thought it wasn't actually removing the clip
    this.removeMovieClip();
}




So my theory is that the movieclip isn't actually being removed, but it could be caused by some other problem that I don't realize so any other theories would be welcome as well. Right now, I'm reduced to staring at the screen and asking the computer, "Why aren't you working?"

Loading And Unloading?
been a while since I have worked in flash...

Using Flash 8, here is what I am trying to do.

I have a movie that has a section ( movie section ) that will randomly load and play 1 of 7 movies as the timeline plays.

It will also have a menu on the side that will stop the movie and load and play which ever movie ( 1 - 7 ) that was selected. At the end of the movie I would like it to continue on playing what would normally play after the "movie section".

So if it was never touched,.. it would play the timeline over and over and randomly insert (movie 1 - 7) when needed. But if one was selected from the links.. it would shoot back to the start of the "movie section" and play it and then carry on.

Just looking for some guidance here on this, any help would be great. Thanks!

Loading/unloading Swf
Hi,
I,m building a site in flash that loads different parts from external swf. No problem in doing that, but what are you personal suggestions.

I heard somewhere that the unload action can be a bit unstable, so the solution i currently use is...
loading the new swf in level 2 for example. If i need to see other part, just load on level 2 gain the new swf. When finished with viewing this files and what to return to original state, load a empty swf to level 2.

How do you do it? any ideas... I may be doing a 'no, no' without realising...

Loading/Unloading SWF's
Just a quick n00b question:

I want to load an SWF into another one, but starting on a particular frame (i.e. when the new movie comes in I don't want it to run from the first frame).

The button that brings in the new movie has this code on it:


Code:
on(release){
loadMovie("home.swf",2)
}
So what do I need to add to that to make the movie start on a different frame? I can't figure it out, and I'm a total novice! Thanks in advance.

Unloading A .swf Before Loading A New .swf
Hi

I have a basic understanding of AS2 but I struggling with AS3 so I am hoping someone can assist me with a problem.

I have a flash movie with an empty movie clip called "textpanel" I then have six buttons which when clicked will load different .swf files into the empty movie clip called "textpanel"

So far using the code below on a frame I can get the different .swf file to load into the correct movie clip, but every time I click on a different button it loads the new movie over the top of the old one.


function homebutclick(evt:MouseEvent):void {
var homebut:Loader = new Loader( );
homebut.load(new URLRequest("ht.swf"));
textpanel.addChild(homebut);
}
home_btn.addEventListener(MouseEvent.CLICK, homebutclick);


In AS2 I would use the unloadmovie command but I'm unsure in AS3.

Could someone please help me and update the code below with an unload command.

I'm sure this is something simple for you AS3 experts to do and with your assistance I will learn something that is really troubling me :-)

many thanks

Chris

Loading One .swf And Then Unloading The Other .swf
here i am once again! -

what i've done is i've loaded an external .swf file in a normal movie (imageholder77) , basically when i click a button it loads imageholder502 above imageholder 77 and then unloads imageholder77 -

PHP Code:



on (release) {
    createEmptyMovieClip("imageholder502", 502);
    imageHolder502._x = 210;
    imageHolder502._y = 0;
    loadMovie("MMMU.swf", "imageholder502");
}

on (release) {
    unloadMovie("imageholder77");





but for some reason flash does it at the
same time causing a blink of the unloaded moive clip (imageholder77)
is there a way using actionscript to load imageholder502 first
then unload imageholder77 so u dont see imageholder77 being
unloaded?

Loading And Unloading
ok i tryed on my own for a few hours to do this and its driving me mad need help please : )

i am trying to create a movie clip then load a picture into it then control that

movie clip with a button (i want to load and unload the picture)

here is the red button

ActionScript Code:
on (rollOver) {
    if (_root.back.grey==true); {
    this.unloadClip(grey);
  }
    if (red!=true) {
      this.createEmptyMovieClip("red",2);
      red.loadMovie("image1.jpg");
      _root.back.red = true;
  }
}
here is the grey button

ActionScript Code:
on (rollOver) {
    if (_root.back.red==true); {
    this.unloadClip(red);
  }
    if (grey!=true) {
      this.createEmptyMovieClip("grey",2);
      grey.loadMovie("image3.jpg");
      _root.back.grey = true;
  }
}
what i want to happen is

( example red button )

if you roll over the red button when there are no buttons
loaded then load the red button

if the red button is loaded dont reload the red button

if the grey button is loaded when you rollover the red button unload
the grey button and load the red button.


anyways my code works but only once. as in i rollover the red button and the image appears, then i roll over the grey button and the red image goes away and the grey image appears after that i cant reload the red and if i start with grey button first i get the same result as in after 2 rollovers everything stops working.

im very new with object oriented programming so please try and make it as simple as possible cause i think i complecated the crap out of it.

Loading And Unloading
ok i tryed on my own for a few hours to do this and its driving me mad need help please : )

i am trying to create a movie clip then load a picture into it then control that

movie clip with a button (i want to load and unload the picture)

here is the red button

ActionScript Code:
on (rollOver) {
    if (_root.back.grey==true); {
    this.unloadClip(grey);
  }
    if (red!=true) {
      this.createEmptyMovieClip("red",2);
      red.loadMovie("image1.jpg");
      _root.back.red = true;
  }
}




on (rollOver) {
    if (_root.back.red==true); {
    this.unloadClip(red);
  }
    if (grey!=true) {
      this.createEmptyMovieClip("grey",2);
      grey.loadMovie("image3.jpg");
      _root.back.grey = true;
  }
}
( example red button )

if you roll over the red button when there are no buttons
loaded then load the red button

if the red button is loaded dont reload the red button

if the grey button is loaded when you rollover the red button unload
the grey button and load the red button.


anyways my code works but only once. as in i rollover the red button and the image appears, then i roll over the grey button and the red image goes away and the grey image appears after that i cant reload the red and if i start with grey button first i get the same result as in after 2 rollovers everything stops working.

im very new with object oriented programming so please try and make it as simple as possible cause i think i complecated the crap out of it.

Loading And Unloading MC's
i am trying to rebuild my site in flash
2 different sections i have - illustration & print
when i click on illustration button, i need to have "illustration.swf" load
then when i click on print button i need "print.swf" to load, but when i load "print.swf" the illustration MC is still there on top of the "print.swf"

here is the code i have on the buttons currently

on the illustration button:

on (release) {
unloadMovieNum(1);
loadMovieNum("PP_work_illustration.swf", 1);
}


on the print button:

on (release) {
unloadMovieNum(1);
loadMovieNum("PP_work_print.swf", 1);
}


and like i said, the illustration swf loads good, but when i click the print button the print swf loads underneath the illustration swf and the illustration swf is still there.

any help would be greatly appreciated, as this is frustration why it isnt working. thanks guys

Loading And Unloading SWF
I have 2 SWF Files. One is my Main Menu. When I click the button to launch the other SWF I use this coding from the help file:
var request:URLRequest = new URLRequest("riskTaking.swf");
var loader:Loader = new Loader()
loader.load(request);
this.addChild(loader);

This launchs the other SWF ok and shows over the First SWF. Now on the launched SWF I have a Menu button that I want to use to close down the SWF and return back to the Main Menu. I have tried everything in the help file and nothing seems to point me in the right direction. I tried the unload but it does not seem to see the first SWF (MainMenu). Can anyone help point me in the right direction?

Thanks

Loading New XML And Unloading Old XML
I would like a button in my image gallery, which dynamically loads thumbnails and full sized images from an XML file, to load a new XML file (containing a new list of images), and unload the old set of images, that were generated by a previous XML file. As it is now, all old thumbnails from the previous list remain, and new ones are loaded on top of them. How do I unload the previous XML file??

Thank you to anyone who can help!

Loading And Unloading Swf
I am making a site and I want each button to load an swf, which would be the content of each page. When I click on each button the swf will load, however, the old swf will not go away. how does one do this. Thanks.







Attach Code

stop();
import noponies.display.FullBrowserBg;
import caurina.transitions.*;

var newBrowserBg:FullBrowserBg = new FullBrowserBg("images/water.gif", false);
addChildAt(newBrowserBg,0)

about.addEventListener(MouseEvent.ROLL_OVER, about_ROLLOVER);

function about_ROLLOVER(e:MouseEvent):void
{
Tweener.addTween(about, {alpha:.75, scaleY:1.2, time:0.2, transition:"easeInSine"});
}
about.addEventListener(MouseEvent.ROLL_OUT, about_ROLLOUT);

function about_ROLLOUT(e:MouseEvent):void
{
Tweener.addTween(about, {alpha:1, scaleY:1, time:0.2, transition:"easeInOutBounce"});

}
about.addEventListener(MouseEvent.CLICK, about_CLICK);

function about_CLICK(myevent:MouseEvent):void{
var loadMain:Loader = new Loader();
loadMain.load(new URLRequest("clip0.swf"));
stage.addChild(loadMain);
}

contact.addEventListener(MouseEvent.ROLL_OVER, contact_ROLLOVER);

function contact_ROLLOVER(e:MouseEvent):void
{
Tweener.addTween(contact, {alpha:.5, scaleY:2, time:0.2, transition:"easeInBounce"});
}
contact.addEventListener(MouseEvent.ROLL_OUT, contact_ROLLOUT);

function contact_ROLLOUT(e:MouseEvent):void
{
Tweener.addTween(contact, {alpha:1, scaleY:1, time:0.2, transition:"easeInOutBounce"});

}
contact.addEventListener(MouseEvent.CLICK, contact_CLICK);

function contact_CLICK(myevent:MouseEvent):void{
var loadMain:Loader = new Loader();
loadMain.load(new URLRequest("clip1.swf"));
stage.addChild(loadMain);
}
music.addEventListener(MouseEvent.ROLL_OVER, music_ROLLOVER);

function music_ROLLOVER(e:MouseEvent):void
{
Tweener.addTween(music, {alpha:.5, scaleY:2, time:0.2, transition:"easeInBounce"});
}
music.addEventListener(MouseEvent.ROLL_OUT, music_ROLLOUT);

function music_ROLLOUT(e:MouseEvent):void
{
Tweener.addTween(music, {alpha:1, scaleY:1, time:0.2, transition:"easeInOutBounce"});

}
music.addEventListener(MouseEvent.CLICK, music_CLICK);

function music_CLICK(Event: MouseEvent) {


var newMedia:Loader = new Loader();
var cont:MovieClip = new MovieClip();


newMedia.load(new URLRequest("clip2.swf"));

cont.x = 400;

stage.addChild(cont);
cont.addChild(newMedia);

}

Unloading A Swf And Loading A New One.....
i ask stupid qustions but i dont know the answers...
ok so my movie plays till frame 165 than stops and theres a button on that frame when you click it plays the rest of the movie till frame 200
on the 200th frame i need the movie playin to be deleted off the "container" MC
and a new movie to be loaded into it...
something like

"unloadMovie(enter.swf);
loadMovie(main.swf);"

but not..... any help would be greatly appreciated..

Loading & Unloading SWF's
Alright, here goes. Pretty simple question but I've been struggling with it all day. I have a parent movie/swf and using one button on the 1st scene of my parent swf I am loading another swf ("child") into a blank movieclip in scene 7 of my parent swf. Using load or unload functions (or anything for that matter) is there any way for me to send the viewer back to the 1st scene of my parent movie from the already loaded "child" swf in scene 7? If not, what's another way for me to accomplish this. I'm kind of an actionscript noob, if you can't tell. Script examples would help alot. Thanks

Unloading XML Before Loading Another...
This image gallery I am working on loads the thumbnails(from the XML) into a scrollbar. It works for the first one fine, but when I click on another button for another gallery it adds the thumbs of the new gallery at the end of the ones already there, but what I trying to do is have the previous thumbs unload then load the new xml with the appropriate thumbnails.

I have tried removeNode(); to unloadMovie(); and various other functions but nothing works. The XML does not unload before the next one loads EVER. The removeNode(); doesnt even remove all the children, which i thought it was supposed to.


Code:
xmlData.firstChild.removeNode();
This is in a function called on the release of all buttons, but it doesnt do anything. This function is located in the same frame as the loadXML function. Is this the wrong place to put it?

Any thoughts or discussions are very appreciated.
Thanks.
Peace.

Loading And Unloading:is This Possible?
i just had some question,.,.,
let say in the middle of the frames ( ie: frame 115 ) can i set actionscript to
loadMovie("contactform.swf", 115) and unload it on fram 150?? its with in a movieclip

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