ActionScript 2.0 :: Variables/functions "pushed" To Level0 On LoadMovie?
Oct 30, 2006
I'm trying to get an interface that will load external MCs that contain timeline control functions in them. Basically these are long "topics" that currently interface through a web content program - I would like to unify them into a single flash-based interface, but the functions that are in the external flash files, such as this:
dwnLine = function () {
totalBytes = getBytesTotal();
loadedBytes = getBytesLoaded();[code]......
get pushed to level0 when you load the next MC, instead of just being deleted with the old MC. I've tried creating a function on the root timeline to delete the variable and the specific function names, but its not working, it just fights with the phantom functions endlessly creating/deleting the variables. This is turn screws up the timeline in the new MC that was loaded. Does anyone know why/what Flash is doing here? If I knew the reason it was being pushed up to level0 I could stop it,
on (release) {
loadMovie ("Loader1.swf", "/contentclip");
}
to load the new MCs into a container MC called "contentclip"
View 9 Replies
Similar Posts:
Jan 5, 2012
I have 2 flash files,one is mine (the main container) and one is a external swf.I want to load the external SWF to my container SWF.I write this code in my AS2 container, inside the main timeline flash (mine flash).In the first method, I add a movie clip with instance name mc1 to the first layer:
mc1._lockroot = true;
mc1.loadMovie("external.swf");
countdown = function(){
trace("ok");
}
countdownIt = setInterval(countdown,1000);
This code works fine in most of the cases, but I found many SWFs files that it dosen't work with. These SWFs and work with the following code instead:
loadMovieNum("external.swf",0);
countdown = function(){
trace("ok");
}
countdownIt = setInterval(countdown,1000);
I really try to use that code - BUT !!! -> if I use this code the external SWF predominant, my main SWF code and all the rest of my code dosen't work (like the setInterval() timer).... I want to load the SWF like the second example and still run the setInterval() function.
View 1 Replies
Sep 26, 2008
I am encountering a problem with addChild and removeChild.I would like to add a child when one button is pushed and remove the same child when another button is pushed.The code I am working with doesn't work. (see attached code)and this is the error message I get back.1120: Access of undefined property gallery.
View 2 Replies
Oct 2, 2003
I have this script on my main timeline:
[AS]
stop();
this.createEmptyMovieClip("tntHolder", 2000);
[code].....
View 1 Replies
Apr 16, 2004
Im having trouble loading a clip through loadMovie and setting some properties of that newly loaded movie at the same time. For example I have an XML object loading data from a php page. The onLoad for that XML object loads a basic table movie, and tries to set the title and body fields of that movie. The problem is that I can load the movie, but I cannot set the properties of that movie until much later. Below are the examples of the failing code.I just cant figure out how to load data into a loaded movie. Ive even tried to include the table movie in the library of the main movie, so theres no loading latency. Even preloading the movie and jut duplicating that preloaded movie.
//frame actionscript
this.info.onLoad=function(success) {
if (success) {
[code]....
View 1 Replies
Jan 25, 2010
I have a log in page with two buttons "credit" and "browse" . If the user selects "browse" I want the button to start the quiz globally disabled on level0 (the log in page is level1). I think I need to leave the log in page playing on top in an empty frame for this to work. I have tried:
_global._level0._root.quizBtn.enabled = false(); I have tried that script on the button action of the "browse" button.
View 3 Replies
Mar 30, 2006
Why does everything in Flash have to be such a pain in the ***? You think you're going to do something simple in 5 seconds of typing, but half of the times it turns out you're wasting hours searching for a way around some stupid restriction of flash.This time I made a movie that uses some variables that are specified in the .html (FlashVars). Sending these variables from html to the flash movie is no problem. But I tried to see if my movie still works when it's loaded into a holder movieclip. So I use the following code to load the movie and send the same variables to it:
PHP Code:
mc_holder.loadMovie("imageviewer.swf?width=700&height=350&imageList=afbeeldingen.txt&settings=ivsettings1.xml");
[code].....
View 2 Replies
Jan 28, 2005
I have been looking for posts regarding using global variables in and from external movies, I am having problems, but am sure it is easy enough to do.
In the main movie I define a global variable _global.shorts = false.
I have a button with the following on...
on (release) {
_global.shorts = true;
popup_mc.loadMovie(shorts.swf, "POST"); //I've also tried GET!
}
This opens a popup window into an empty movie clip on my page, and turns off a variety of properties.
In my setup script on the first frame I have:
if(_global.shorts == false){
carryOnAsNormal;
}
if(_global.shorts == true){
disableA;
[Code]....
and does not write "false" back to the global that was defined on the setup script, rather it creates it's own "local" global variable called _global.shorts which is no good to man nor beast!
I have tried using _root._global.shirt, _root.shirt, adding the variables to the loadMovle call, but nothing seems to let me trace the global with the correct value in the shirt popup.
Is there something I need to do to pass the variable to the shirt.swf when I load it?
View 2 Replies
Jan 10, 2009
Does anyone know how I can load a movie into level1 that has sounds embeded in it and be able to play them? I would like to load the sounds using code on the timeline. I don't understand why my method is not working.Here is what I tried.I have a movie that I am loading into level 1.My sounds are inside the movie that I load into level1.So I ran a test and if I load the movie into level0 the following code works fine and plays the sound.[code]But then when I load the move into level1 and change the code to the following, it deosn't work.[code]
View 3 Replies
Aug 22, 2011
im trying to load an swf into another swf that has a variable in the text input field. Im a designer and not a programmer but I am using this tutorial to get started in loading a form with a variables in it.[URL]..
What im doing is trying to duplicate is the text box so that when i want to load new_box.swf (with a variable name "company") into main.swf into a movieclip with an instant name "loader." using this:
on (release) { loadMovie ("new_box.swf", "_root.form.loader");}
I can get the movie to load but it loses the variable "company" in the process and when i send the form it doesnt work. If i just keep it in the main timeline it works but not when i loadMovie.
View 1 Replies
Jul 17, 2010
I looked up MovieClipLoader tutorials and finally came up with the code:
[code]...
myMCL.loadClip("filename.swf", mcholder); //mcholder is the movie clip holder placed on stage manually
[code].....
View 3 Replies
Aug 20, 2009
If I have a function and I want to call a variable from another function (only 1variable), how do I do it? I know in the olden days you could set the variable to local or global, but that does not seem to work anymore. There is only 1 variable I need access to, but all the tutorials I have come across talk about making classes for multiple variables.
e.g. function2();
{
variable_b = variable_a;
}
[Code].....
View 3 Replies
May 8, 2010
Why does this not work???
Code:
function myFunction(val0,val1,val2){
trace(this["val"+0);
trace(this["val"+1);
trace(this["val"+2);
}
myFunction("hello","test","hi")
All i get is undefined. If i just put "trace(val0)" i will get "Hello" -- so i cannot work out how to get the value of the dynamic variable inside hte function?
View 4 Replies
Mar 16, 2012
I got this variable:[code]is there a possibility that the compiler gets confused because my variable has the same name like the functions's parameter (type = type)? i'm not certain about this topic. Normally I'd write my function's parameter like this (if such a case occurs):[code]just to make sure the names do not exactly match.
View 3 Replies
Nov 16, 2005
I can't figure this out.
Code:
function createTextBoxes() {
for (var n=0; n<caption_obj.textXML.length; n++){[code].....
The XML portion is working fine. What I'd like to be able to do is access the created text fields outside of the function. For example:
captions1.alphaTo(0,1,"linear",1);
This works fine when it's inside of the function, but outside of it, it won't. Basically I need to time the captions to things that are happening in an animation. The animations are also tween driven, so it would be something like obj_mc.tween("_x", 200,2,"linear", 5,fadeOutCaption1); with fadeOutCaption1 being a function that fades out the first caption and brings in the second. If there is a better/more effecient way of doing this let me know.I also can't seem to apply any styles to the text field. Do I need to create an array or object with ["captions"+n] and then pull from that?
View 2 Replies
Jan 5, 2012
i have 2 flash file,one is mine (the main container) and one is a external swf.i want to load the external swf to my container swf.i write this code in my as2 container code inside the main timeline flash (mine flash) -----first of all i add a movie clip with instance name mc1 to the first layer
Code:
mc1._lockroot = true;
mc1.loadMovie("external.swf");
countdown = function(){
[code]....
i really try to use that code - BUT !!! -> if i use this code the external swf predominant my main swf code and all the rest of my code dosent work (like timer of trace)....
View 7 Replies
Feb 5, 2009
haven't wrote here for a while!This is what I'm trying to do:
var level:Number = 1;
var goat:* = "thisIsLevel" + (level + 1);
var camel:Function = goat;
[code].....
View 3 Replies
May 26, 2009
I have an animation that has roll overs controlled by AS (see code below). It works the way I have the code, but it's really messy code. And I hate that I'm have the functions rewritten for each event.How can I simplify this code?
//On the main timeline
var gearsEnabled:Boolean = true;
var gears2Enabled:Boolean = true;
[code]....
View 4 Replies
Jul 19, 2009
I know PHP, JavaScript and AJAX. All of these other languages easily allow me to pass variables through a function, but I can't seem to work out how to do it in ActionScript 3. As you can see from the code below, I have created a variable called 'flag', this variable is set to 'notAdded'. However, once the function is called, I want to change the variable to 'added'. This for some reason does not work, the variable update only works within the function itself. There seems to be no global scope for functions.
Code:
var flag:String = "notAdded";
bobRunning.addEventListener(MouseEvent.MOUSE_UP , bobRunningUp);
if (flag=="notAdded"){function bobRunningUp(event:MouseEvent):void{ bobRunning.width = 30;
bobRunning.height = 30;
flag = "added";
}}trace(flag);
View 5 Replies
Jul 14, 2010
I'm trying to create a JW player plugin, a part of the source code is shown below:
public function initPlugin(player:IPlayer, config:PluginConfig):void {
api = player;
var streamUrl:String = 'xxx';
[code].....
View 1 Replies
Jan 12, 2010
i've just written the function below and I want to perform it multiple times but with different urls,
[Code]...
View 7 Replies
Nov 30, 2006
I was wondering if they found a better way of allowing the use of variables outside of an on function. For example in the script below I can use the variable bounds inside the target.onEnterFrame function because it's declared inside the constructor. However I can't use m_Bounds even though it's declared in the class.[code]...
View 7 Replies
Aug 13, 2007
I have a variable in the _root called 'ordered'. I have another variable called 'total' inside a function called 'loadXML'. 'total' receives a number value from a node in a XML file correctly. I now want to transfer this value to the variable 'ordered' which, as I said, is in the _root. However, 'total' is restricted to the function and I can't access it from the variable in the _root. Neither can I transfer the value from the variable in function to the _root.ordered, since such a line targets the _root of the function itself.I guess this isn't too hard to solve, probably just a path issue, but I have a few rather large gaps in my knowledge of actionscripting.On the stage, there are three objects; a movieclip with the instance name 'clip', a movieclip with the instance name 'orderbox' and finally a dynamic text field with the instance name 'pos_txt'.[code]
View 2 Replies
Oct 16, 2007
I am building a flash photo gallery that is fed by an XML file, now I am fine with all of the XML things in flash, my problem comes when creating the thumbnail images onRelease event. Here is my code:
Code:
_global.counter = 0;
for (_global.counter = 0; _global.counter<itemArray.length; _global.counter++) {
//populate thumbnail array with URLS
[code]....
The problem is that when I release the mouse button I get a variable undefined error in the output window. I have researched and have found that my problem is that I can't pass a variable from the main function to the onRelease function.
View 3 Replies
Dec 18, 2008
I have a stupid question. I got this variable:
Code:
var type:int;
and this function:
[code].....
View 5 Replies
Aug 1, 2004
how to access variables that are declared in a movie clip from a function declared in that same movie clip.
i.e.
****************************
var int1 = 1
var int2 = 2
[Code]....
I'm trying to do this in the main movie clip of a movie that I plan on importing dynamically in another movie. I've tried to use this.int1++, but I think that flash was looking for a variable that belongs to "myfunction" when I did that. I could just use _root.int1++ but like I said, I plan on dynamically loading this into another movie, in which case it would be pointing to the wrong movie.
View 2 Replies
Feb 23, 2010
I'm working on a project for school which is requiring me to make a game using Flash and ActionScript 3.0. One of the tasks I have to do is load an external XML file that will be displaying questions and answers. I've looked at google to find simple scripts for loading XML, one example being below:
Code:
var myXML:XML;
var myLoader:URLLoader = new URLLoader();
[code].....
View 1 Replies
Oct 20, 2009
I was wondering if ActionScript had some way to call functions and classes from variables, like they do in PHP:
function funcname() {
print "Potatoes come from tree";
}
$function = "funcname";
print $function; // Prints out "funcname"
$$function(); // Prints out "Potatoes come from tree"
In case you don't know the syntax for PHP, you should know that anything perpended with a $-symbol is a variable.
View 1 Replies
Jan 21, 2010
How can I trace all available Movie Clip variables and functions?
View 5 Replies
May 3, 2010
Trying to find the best way to use the xDoc variable in the newImg function without adding the newImg eventListener to the xmlLoaded function
var myXML:XML;
var xDoc:XMLDocument;
var xmlLoader:URLLoader = new URLLoader();
[code].....
View 5 Replies