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




Local Function Variables? Limitation Of Actionscript?



I've got a recursing function [as in it can be called by itself or by another function it calls] as part of an AI routine in a little game I'm making.
I'm finding that the variables that I want to be local to the function keeps getting screwed up by the later iterations of the same function.
Is there a "local" or "my" command in flash so that if a function recurses, the variables that should be local to the function won't get altered by the subsequent function calls?
I know how screwy of a practice it is to recurse functions, but it's the most efficient method in my case.



FlashKit > Flash Help > Flash ActionScript
Posted on: 02-10-2002, 04:52 AM


View Complete Forum Thread with Replies

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

Local Connection Limitation
I have a problem with local connection. It works fine on one machine, but when I try to open it on another local machine, I get nothing. It is only registering on one machine at a time. Is this a common problem? Am I missing the point of local connection? If so, are there any recommendations for having two swfs talk in one .html page?

Thanks.

Function Using Local Variables
I have about 30 mcs which all use the same onClipEvent(enterFrame) action and it is quite big. Can I recycle the script? The problem is all the mcs are using local variables set in the onClipEvent(load) handler.

But the onClipEvent(enterFrame) script is exactly the same. Basically just need some script that effectively reads the script from the main source and puts it into each mc's onClipEvent(enterFrame) handler.

Can this be done?

Limitation Of Number Of Variables Passed
Does anybody know if there is a limit on number of Variables passed in to Flash? Is there a limit on values that are passed in the string? Please let me know if there is any documentation about this stuff. Thanks

Limitation In Length For Sending Variables?
Hello.

I am setting up a little thingie where I end up sending quite a long string to a .PHP script which should save it as a file on the server.

I am sending things using GET in the format [scriptname.php?whatever=longStringContents]

Now everything works just perfectly until the string reaches a certain length.
My tests so far show that it still works when the length is 5084 characters long, but it does NOT work when the length is 6078 characters long.

Does anybody know if this makes any sense. I have in the back of my head a memory of reading somewhere about a String length limitation in Flash. But I am unable to find it at the moment.

I guess what I want to find out is if THAT is the issue, or is it a more general thing such as the limitation would not be within flash, but within sending with GET or sending with any method.

Thanks a lot beforehand

Local Variables
I'm using the local variables actions in flash MX works great...My only pitfall is if the end user moves the file from folder to folder the local vars can't find the flash movie ... is there a way around this... also is way to save .txt files from flash on the harddrive?

thanks

Local Variables?
hi all!!


im stuck on somthing so easy - grr!


i have my main movie wich loads another swf file into it. in that swf file i have a text box and a button, when i click the button i need it to display "hello" in the text box. my problem is i cant use its _root address.

would it be something like this?:

_local.mc.myText = "hello";

thanks

Local Function / SetInterval
Why are my local functions / setIntervals not working? I'm using this code, which should work fine.
code: pause = function () {
trace("wuddup");
thisClip.play();
thisClip.clearInterval(thisClip.stall);
}
thisClip.stall = setInterval(pause(), 3000);

I've attached the source below.... just open it and goto the "02-INTROS" folder. Choose the "01-introGettingStarted" MC.

Local Connection Function Help
Ok i have been messing about with the localConnection function in flash. And have stumbled upon a problemb.

I have two movies - a sender movie and a receiver movie - In the send movie a buton triggers the local connection with causes a movieclip to play in the receiver movie.

Here is the script ive used in the sender movie (1st frame t/line):


Code:
myButton.onRelease = function() {
myLocalConnection = new LocalConnection();
myLocalConnection.send("incomingMessage", "onReceive");
myLocalConnection.close();
};


and on the receiver:


Code:
myLocalConnection = new LocalConnection();
myLocalConnection.onReceive = function() {
animationClip.play();
};
myLocalConnection.connect("incomingMessage");


Ok, so far so good. Now the problem...

I want to be able to make another button which can call, using a second button in the sender movie, a second movieclip in the receiver clip to play.

So for example the button 'myButton' will call a clip animationClip2 to play. As well as the original.

Any help would be much appreciated. Hopefully it wont be difficult to save - probs just my as-n00bishness.

Thanks again.

Function Local Variable
Hi, im calling a String from an external file, the string is return to a function (has to be for the pluging im using)

The string then needs to be split in to an array which is fine, but the content of the array then needs to be available to the rest of the movie. Its my understanding that the array will be local to the function because it was created in the function so cant be used outside the function.

how can i extract a variable from a function so it is no longet local

any help will be appriciated

Function Local Variable?
Hi,

I'm trying to apply a gotoandstop function, by getting a frame label from an array...


ActionScript Code:
var aLabels:Array = ["Home", "AboutUs", "Charity", "OrderInformation", "Faq", "Catalog", "Press", "Contact"];
for (nNum=1; nNum<=7; nNum++) {
    _root["but"+nNum].onPress = function() {
                _root.gotoAndStop(aLabels[nNum]);// It doesn't recognize this var..:-(
    };
}


The only thing my buttons do, when I trace them, Is telling the length of my array, so, within the function it doesn't recognize the nNum variable..
Is this because its local? And how can I get to it?

thnx!

Variables: Local Or Global?
Hi everyone. Hope you can understand me

I built a time line with several "pages"
and, in each page, I have lot of buttons.

STEP 1
I thought to assign a variable to each "on release"
tag different for each button.
this "On release" consist of

On release
xxx=1
www=0
eee=0
....
play

(The syntax is not this, obviously
but the code initialize all but the variable I need)

the playhead continues its run,
reach the end of the page and there it
founds a frame action

goto and play
label "base"

STEP 2

it is supposed to go to "base" label
then, after some frames (with some tweenings) there is another frame action

If xxx=1 go to and play "something"
If www= 1 ....

and so on

Is it clear?

The problem is that it does not function..
the play head reachs the STEP two and then
it plays another scene, ignoring all the coding!
I tried to declare the variables i need at the beginning
of the scene but none changes..
I still cannot control the direction of the play head
from "far places" in the scene.

anyone has ideas about it?

thanks in advance

davhub

Local To Global (variables)
How do i make variable framenumber in _root.img1.goto to be used somewhere else?

I need the value in framenumber to be set to numbers in _root.img1

how do i make framenumber == numbers?

Problem With Local Variables
I am trying to create a isometric room with multi user avatars, on the internet. (As a test for a bigger project)

I seem to do everything rite, but when i run it the avatar whont walk when i click any position with the mouse.
When i try to adress the variables within the movieclip "hero1", which is attached to the stage from the library (in the library its called "hero2") the variables arent stored in the movie clip.

How do i store variables in a movieclip from another movieclip, so i can use them as local variables in the target movieclip.

Actionscript Code:

_root.hero1.mousex=math.round(0.5*( (_root._xmouse-_root.offsetX)/(_root.tileWidth*0.5) + (_root._ymouse-_root.offsetY)/(_root.tileHeight*0.5)));
_root.hero1.mousey=math.round(_root.hero1.mousex- ((_root._xmouse-_root.offsetX) / (_root.tilewidth*0.5)));


Also i have attached the FLA file.

I hope you can help me with this problem, cause i am stuck

Variables Local To Global
Hi,

I am trying to access a different element of an XML file by using a button, I then want the button to go to a clip where this can be displayed.

In the first frame I have loaded the XML file and created a variable called thisfish which contains the data fron the first element of the XML:

data = new XML();
data.ignoreWhite = true;
data.load("aquarium.xml");

data.onLoad = function(success){
if (success){
if(data.status==0){
thisFish = data.childNodes[0].childNodes[0];

parseData(thisFish);

}else{
trace("Parse Error: "+data.status);
}
}else{
trace("Load Error")
}
}

Then when my button is pressed I want to create a variable (I have called it getfish) and have it store the details of another part of the XML object, this is my code:

on(release) {
var getfish = thisfish();
var getfish = _root.data.childNodes[0].childNodes[3];
_root.textbox2.localToGlobal(getfish);
_root.gotoAndPlay("end");
}

In my final frame (called "end") I want to be able to access the data in getfish, however it comes back as undefined.

_root.loadVars(getfish, "GET")
trace(getfish);

stop();

Is there a genius out there who can help me?

Thanks in advance,
Steve

Local Variables In Frame
In a Actionscript book I've read the following definition of a local variable:

"Local variables, unlike globals, are only available in the current script. In the next frame, the variable won't exist. You can certainly create a new variable with the same name, but the previous contents from the last frame will not be in it."

As a newbie on AS I've already learned some more about the differences between local and global variables. But I've been wondering: has this definition ever been true in previous Flash versions?

E.g. when I place this script on keyframe 1:
var test=10;
trace (test);
and the next new script on keyframe 2:
trace (test);
stop();
according to this definition I should get 10 and "undefined" in the output window. Because the script in keyframe 2 is new and the "test" variable doesn't exist anymore (just in the script/frame where it's used: keyframe1).

But as aspected I get 10 twice as a result. So I'd like to know whether the author made a mistake or that in a previous Flash version (It's a book on Flash MX) this kind of thing happened with local variables (not existing as from the next frames).

Displaying The Value Of Local Variables...
Hello! This is my first post here, but I hope that it isn't my last! I plan on helping out as much as possible as I learn!

My questions is about variables...(Flash 8 Actionscript 2)

On my 'action' layer I've decalred a variable named SurfaceArea. The form takes in three values - length, width, height. Then calculates surface area on the fly. So, when they put in the three numbers, I have a text field that displays the calculation as they type them in.

In order to finish out my application, I need to be able to store that value in a variable. So, I need to give SurfaceArea the value of that text field. Then, to ensure it is working, and for the rest of the application, I'd like to have a button that when clicked the application displays the value of SurfaceArea variable and also does one other calculation.

So, at this point, I just need to know how to display a variables value and ensure that I have stored it correctly.

Right now, I have my variable on my action layer like this...So, I'm assuming it is grabbing the value of that text box on the fly. So, if I enter in 10x10x8 the variable should have the value of 420.


Code:
var SurfaceArea = txtSurfaceArea.text


Then after that, I want to have the button clicked and then somewhere display the value of the variable. Make any sense? Please let me know. Thanks!

[F8] Accessing Local Variables
When in the _root level, how can I get the value of a variable from within a movieclip? I know that I can use a get_____() method, but I only know how to make methods in Java. If there isn't a predefined method to access local variables, could someone give me a sample user-created method?

Thank you very much for your help!

Global / Local Variables?
Hi,

If you have a variable on the main time line, you can reference if from inside any movieclip by using _root.variable

If you have a variable inside a movieclip, can you reference the variable by using _root.mymovieclip.variable ?

Also what does _global do?

Thanks

Local Connection Variables
How would I create a local connection variables
to load flash movies on a page that has
three empty flash containers that I want to load movies
as different pages.

I want a navigator movie to be able to load the moves by
using a local connection variable.

Cant this be done?

Can anyone point me in the right direction?

Thanks for your help in advance

Mark

Scoping Local Variables
Hi all,

How do I reference a local variable defined in a function?

eg

ActionScript Code:
function MyFunction()
{
    var Obj1:Object = new Object();
   
    trace(Obj1);   //ok
    trace(this["Obj1"]); //not ok
    trace(this.MyFunction["Obj1"]) //nor this
}


I need to be able to programmatically loop through several numbered variables

[F8] Load Local Variable Outside Of Function
I'm using flash 8, action script 2.0.

I'm using an onLoad function to load an XML file. I have a variable inside that function and I need that value outside of the function. I'm not exactly sure how I can go about this. This is my summarized code. Any help is appreciated.

xmlVideos.onLoad = function(){
var total = xmlVideos.firstChild.childNodes.length;
}

trace (total);

//I realize this trace will not work because "total" is local, but how might I get that variable global? I tried _global with no success.

Thanks in advance

Local Variable In Recursive Function
I'm trying to create a recursive function to parse a piece of XML, but when it runs it recurses before it finishes its current task. On every level of recursion it appends to the variable for updating an array. It picks up the first tags of the XML file but then it starts using that same variable when it goes back to its original task to finish the loop that called the recursion.

So I guess I need to find some way to keep the variable local to that particular time that it was called?

I just read what I just typed, it's so damn abstract, I have trouble comprehending it.

I was considering posting some code, but I'm up to my neck in versions, and I don't even know which version I would post.

Thanks.
C

Exporting Variables To A Local File
I know its possible for Flash to read variables from a text file on a PC, but I can't seem to find a way of exporting variables to a text file on a PC.

I dont particularly understand SEND and POST but assume they are for Servers and Networks, whilst all I'm interested in for this project is a standalone system.

Is it possible?
Cheers,
Si

Flash Variables => Local, Global ?
If I initialize a variable in one keyframe, can I than always use it in other keyframes of other movie clips.

Another question: I want to get one variable out of a txt file and use it in the flashscript of a menu i'm making. I know how to output it to the screen but I can't get it fixed to use it in my script. I think the problem is related to my first question.

Load Variables From Local Machine?
Hi
Can any one tell me when I can save txt file on any damm local hd drive then why I cant load them back?
----I have used these actions-----
fscommand("save","c:\mytxtfile.txt")

To get back the var:----
loabVariablesNum("c:\mytxtfile.txt",0)

I get the message "Error opening url"

Thanx if any one can solve this!

Local Text Files As Variables
Hello,

How do i load local text files as variables into flash? I am making an application that can be used locvally as a stand alone app or on the web.

Problem 1:
loadVariables("text.txt", 0); // Doesn't work
loadVariables("file://text.txt", 0); // Doesn't work

Problem 2:
The text I want to load is ver complicated and I fear that its contents will skrew with the variables.
example text I want to load:

1:1 paulov 3972 {N-NSM} apostolov 652 {N-NSM} ihsou 2424
{N-GSM} cristou 5547 {N-GSM} kat 2596 {PREP} epitaghn 2003
{N-ASF} yeou 2316 {N-GSM} swthrov 4990 {N-GSM} hmwn 2257 {P-1GP}
kai 2532 {CONJ} kuriou 2962 {N-GSM} ihsou 2424 {N-GSM} cristou
5547 {N-GSM} thv 3588 {T-GSF} elpidov 1680 {N-GSF} hmwn 2257
{P-1GP}


I am at the point of ripping my hair out... :-) plz help.

THX

Fastest Way To Load Local Variables?
I am looking for the fastest way to load variables from a local file into flash mx. The thing is the variables in the file are constantly updating. I'm not sure if I should use loadVariables, XML.load, or SharedObject.

Any help would be appreciated!

Thanks

Global Local Variables :confused:
Hi,

maybe a stupid question but for some reason i cant figure it out .

how to set global variables.
like :
checkpas = "somepassword"
now I want to check this var whenever I want....
how do I set this vars.

In asp I use .ini files that I include in other pages, or use the global.asa but how to manage this in flash AC

maybe its so simple I cant see it

HELP Trouble With 'unloadand Local Variables In Them
Hi,

I am trying to do a pull-down menu, where onClipEvent(load) will pull the MC's down, then on the unload, I want them to pull back out. This is done with the following code. The problem i have is losing access to the attached MC's that were created in the onClipEvent(load) function. I've tried doing work-arounds by putting the attached clips in the parent, but with masks and such, it is messy and this is the way it should be done - so if you know how I can access these created MC's in the unload function you will be my HERO!!

Question about MC's, is the attachMovie(...) the only way to get access to a library MC? Or is there another way that will help me in this? or if i place all the applicable MC's that i want to use in the MC where this code is on??

Thanks!!

onClipEvent (load) {
import mx.transitions.*;
import mx.transitions.easing.*;
menuchoice = _root.menuchoice;
numberofitems = _root.numofMenuOptions[menuchoice];
for (var i:Number = 1; i<=numberofitems; i++) {
this.attachMovie("menuchoice"+menuchoice+"-"+i, "option"+i, this.getNextHighestDepth(), {_x:0, _y: (15+20*i)});
//it grabs the MC's from the library and assigns var names to them. But they go away after this function is over }

for (var i:Number = 1; i<=this.numberofitems; i++) {TransitionManager.start(this["option"+i], {type:Fly, direction:Transition.IN, duration:1, easing:Strong.easeOut, startPoint:2});
}
}
onClipEvent(unload){
import mx.transitions.*;
import mx.transitions.easing.*;
menuchoice = _root.menuchoice;
numberofitems = _root.numofMenuOptions[menuchoice];
for (var i:Number = 1; i<=numberofitems; i++) {
trace("inendloop");
TransitionManager.start(this["option"+i], {type:Fly, direction:Transition.IN, duration:1, easing:Strong.easeOut, startPoint:2});
//right HERE, it gets in the unload function just fine, and does the loops, just doesn't find 'this["option"+i]' since it was created in the above. I've tried creating them again in the unload, but it did not work.

}
}

THANKS!!

Greg

Global Versus Local Variables
In my high school programming course, I was taught that "var" statements made inside a function create "local" variables, that cannot be accessed from elsewhere in the program, unless they are passed back (with a return statement)
I am assuming the case is the same with flash (please correct me if I'm wrong).
In my current program, I am calling a certain function "getInfo (someNumber:Number())" about 20-100 times simultaneously, like this:

ActionScript Code:
for (i=0; i<someArray.length; i++) {
    getInfo(i);
}
within the function getInfo, I am declaring about 5 different variables, whose values depend on the paramater "someNumber". My question is, will these variables replace each other, and if so, what can I do to prevent this?
thnx

Addressing Local Variables In An Array?
How do i address local variables in an array?

The following doesn't seem to work


Code:
function gotoPanel( input, p0, p1, p2, p3, p4, p5, p6, p7 ):Void {
for ( i = 0; i < 8; i++ ){
if ( ["p"+i] != undefined ){
//stuff here
}
}
it tries to see if "p0" ("p1", "pn") is undefined, which ofcourse it isn't because "p0" is a 2 character string...

The code I used above always worked with global variables with expressions like _root["thingy"+i]
Why doesn't it work here on a global level? How do I make it work?

SetInterval And Local Variables With Prototype
I am trying to build a game. As a vb.net webdeveloper, I am introduced with the concepts of oop, but I must admit that I am still a little noobish in this area ...

Anyway, I red a little about classes and the like, but I decided that I didn't want to write a new AS file for every class that I want to use, so I thought that prototyping might do the job as well.

So I am still not fully understanding what I am doing. Anyway, I have this piece of script:


Code:
function objMove() {};
objMove.prototype = new MovieClip;

objMove.prototype.init = function(intID,strName) {
this.loadMovie(strName + ".png");

// example 1: calling with setInterval / setTimeout
this.test = setTimeout(this.moveit, 100);

// example 2: calling normally
this.moveit();
}

objMove.prototype.moveit = function() {
this.intSearchLine = 5;
trace(this.intSearchLine);
}
The problem is, that when calling the function moveit with the setInterval (example 1), the trace (this.intSearchLine) gives me "undefined", whereas calling regulary (example 2), it gives me "5", as expected.

I need to have local variables for each instance of objMove, and I don't understand why this does not seem possible whe using setInterval or setTimeout...

Please, let me know if there is a solution, or what I am doing wrong...

Loading Variables To A Local Maschine
I want to make a dynamic desktop in flash that uses php and mysql or xml to load variables to the users maschine.

If I test the movie in macromedia 2004 everything works fine and the movie can load the variables, but when I export it and try it in a browser it writes out undefined. When I try it with flash player it's good again. As I know flash can acces data from anywhere if it runs on a local maschine. I used CrossDomainPolicy too. I have a firevall but nothing changes when I turn it off. If I run it in flash player the firevall alerts but I can't use this for a dynamic desktop. I want to know if there's a way to acces stuf with flash from behind a firevall or just send something to the firevall so it will ask if I want to allow it or not.
Or somehow make my movie acces the domain where the data is. I don't care how.
The thing is that I need to get data in my flash when it runs on local maschines even if it's behind a firevall. I don't want to hack no firewall just make the firewall recodnise that I am trying to connect with flash to a domain.
If anyone has any ide please write it in becouse I have no idea.

//-----THANKS-----//

Loading Variables To A Local Maschine
I want to make a dynamic desktop in flash that uses php and mysql or xml to load variables to the users maschine.

If I test the movie in macromedia 2004 everything works fine and the movie can load the variables, but when I export it and try it in a browser it writes out undefined. When I try it with flash player it's good again. As I know flash can acces data from anywhere if it runs on a local maschine. I used CrossDomainPolicy too. I have a firevall but nothing changes when I turn it off. If I run it in flash player the firevall alerts but I can't use this for a dynamic desktop. I want to know if there's a way to acces stuf with flash from behind a firevall or just send something to the firevall so it will ask if I want to allow it or not.
Or somehow make my movie acces the domain where the data is. I don't care how.
The thing is that I need to get data in my flash when it runs on local maschines even if it's behind a firevall. I don't want to hack no firewall just make the firewall recodnise that I am trying to connect with flash to a domain.
If anyone has any ide please write it in becouse I have no idea.

//-----THANKS-----//

Saving Variables To A Local Folder
Hello,

I'm creating a game in flash and I want to create some user defined preferences that can be saved and reloaded at a later time. I just want to save a bunch of variables to a file in the directory that the .swf is in (or ideally in a directory below that directory). Saving it as plain text would be fine. I looked into doing XML, but it just seems overkill for what I want to do.

I have this on the main timeline:

testSave = new LoadVars();
testSave.message="Hi there!";

then a movieClip button that does this:

on (press) {
    _root.testSave.send("testSave.txt");
    trace (_root.testSave.message);
    trace ("I did something");
}

I get the traces but no file. What am I doing wrong. It seems that this should be really simple.

isNaN(jaxon)


Local Swf Loading Variables From Remote Php
I'd like to be able to load variables from a remote file to a local swf.
Apparently you cannot do this with loadVariables. Is there any way
to get around this?

Thanks.

Var Scope: Making A Local Var Work Outside A Function?
I know functions use local vars and that data is tossed when they are done processing. Also know I could use a return type to get a value from a function. BUT... how would you return multiple vars, like from an xml parse??

I don't completely understand how to get data processed ina function out into the main timeline. any help is wonderfully appreciated...

Deleting Vars Local To A Function In A Class
Is there any advantage to deleting vars instantiated within public or private functions in a class, or are they removed from memory after the function has been invoked/run? The function below is completely arbitrary for example:

ActionScript Code:
private function someFunctionHere(_ar:Array):Void {
var _swf:String = _ar[0];
var _nm:String = _ar[1];
var _num:Number = 5;

//use them here

delete _swf;
delete _nm;
delete _num;
}

Deleting Vars Local To A Function In A Class
Is there any advantage to deleting vars instantiated within public or private functions in a class, or are they removed from memory after the function has been invoked/run? The function below is completely arbitrary for example:


ActionScript Code:
private function someFunctionHere(_ar:Array):Void {        var _swf:String = _ar[0];        var _nm:String = _ar[1];        var _num:Number = 5;                //use them here         delete _swf;        delete _nm;               delete _num;}

Local And Global Variables And Processing Speed
Someone told me it requires more processing to repeatedly declare local variables through:

var myVariable = 200

than to do it as a global variable

this.myVariable = 200

They say this is because the processor has to create the variable rather than just re-use it.

Is this true?

Loading Variables From Text File On Local
Can anyone tell me the code to put into Flash to load variables from a text file located on C:? I have been trying:

loadVariables ("c: est.txt","_root.display");
loadVariables ("file:///C|//c: est.txt);
etc.....


I need to load it up in one scene and display it in another.

Any suggestions would be greatly appreciated!!!
Please be very specific.

Thank you in advance,

Jason

Global Variable Versus Local Variables...
i have "main menu" MC residing on the root timeline, inside "main menu" MC i have a button that is setting a variable menu == profile. i have another mc called "changer" residing on root timeline and i'm trying to have "changer" MC use a "if" statement that checks the value of the variable "menu" (i set in main menu MC). when i use the "set variable" action, it should set that variable as a global variable right? i can't get the "changer" MC to read the variable! Do i need to use the tell target to set the variable in the "changer" MC??
I hope this is all intelligable enough and i didn't over-explain.. Any help would be greatly appreciated!! Thanks..

GetURL, Local Files & Passing Variables
Hi,
I've got a multi-frame HTML setup, designed to run from the local HD, with a Flash 5 movie in the centre frame, and some javascripts in the top frame's page.

I want the flash movie to be able to pass some variables to the top frame, not by javascript directly, but by loading (or reloading) the top document with some supplied variables:

ie GetURL("top.html?a=b&c=d", "TOP")

where TOP is the name of the top frame

This works fine on the Mac under IE, locally & off a server, fine on the PC off a web server, but fails under IE under Windows when running off the local drive... the document.location property of the top frame remains as

file://local/hd path/top.html

when it should be

file://local/hd path/top.html?a=b&c=d

Is this a known Flash / IE limitation? Anyone got a workaround suggestion? Any advice appreciated, otherwise I'm going to have to use Javascript so pass the variables directly.

cheers,
Hugh

BTW, I've used the GetURL("top.html", "TOP", "GET") syntax as well and it makes no difference, I'm concatenating my own string to specify the variables to pass.

Applying Local Variables Into Movie Clip.
can someone help me? I'm creating an rpg, and i have a movie clip which serves as an interface. Now I want to input the local variables of the whole thing into the movie clip. how do I do that?

Problems With Reading Variables From Local Files
I posted this in the MX forums, but I think this one is more appropriate:

I have a flash document that imports some variables from a text file in the same directory as the flash document. The problem is that it only loads the variables in certain circumstances.

If you try to access the flash document directly, everything is fine. The table @ the botton is the one dynamically populated from the text file variables:

http://www.bostonbloggers.com/problem.swf

same thing with an html file, on the same server, that contains an embed tag for it:

http://www.bostonbloggers.com/problem.html

The problem is when I try to embed the flash document into an html file on another server:

http://24.61.212.36:8080/Test/problem.html

I can't figure out what could be doing this. Any ideas?

I'm guessing that there is some kind flag or parameter that needs to be set to allow other servers/domains to embed a flash document and give it permission to access something like a local file.

[MX] Passing Variables From SWF On Local Machine To SWF On Server
Hi guys,

I've a project whereby I need to pass variables in real time (or as close as possible) from a SWF on a local machine to a SWF online which is viewed by the general public - basically so the web viewers see whats happening in the local SWF. Is there anyway to do this without calling an external file each time?

Thanks,

- Mick

The Same Old Local Vs. Global Variables, In And Out Of Functions, Problem.
For some reason I can't seem to get the hang of this- I apparently just need a bit of help.

Take the following:

ActionScript Code:
stop();

for (i=0; i<5; i++){
    addBug(i);
}


function addBug(id){   
    var tmpBugHolder:MovieClip = _root.main_mc.createEmptyMovieClip("bugholder" + id + "_mc",_root.getNextHighestDepth());
    trace("creating bugholder" + i + "_mc");
    tmpBugHolder.attachMovie("bug","thisBug_mc",_root.getNextHighestDepth());
}

trace(this.main_mc.bugholder3_mc);

My stage is set with main_mc in the root, the movie clip "bug" set in my library to export in the first frame with a linkage identifier of (surprise) "bug" and the actionscript is all in the second frame of the root timeline.

For some strange reason, the above traces out:

Quote:




creating bugholder0_mc
creating bugholder1_mc
creating bugholder2_mc
creating bugholder3_mc
creating bugholder4_mc
undefined




Now, what I'm taking issue with (of course) is the "undefined" at the end there, which is clearly my final trace call, checking to make sure that bugholder3_mc has been created where I expect it to.

What's strange is if I refer to bugholder4_mc in the final trace, it responds as expected:


Quote:




creating bugholder0_mc
creating bugholder1_mc
creating bugholder2_mc
creating bugholder3_mc
creating bugholder4_mc
_level0.main_mc.bugholder4_mc




I feel like this has something to do with the order in which I'm defining variables or that for some reason, "tmpBugHolder" is being shared, even though the function is being called in separate, isolated attempts (or is it? what do I know?).

What am I doing wrong here? I'm sorry to ask such a dumb question, but I just feel like I'm not understanding something very basic that I should be.

Access Local Variables Of Super Method
Is it possible to access a local variable from a subclass that overrides a method in the parent class. You can do it with instance variables, but how about local vars?


ActionScript Code:
protected function foo():void
{
   var x:Number = 34;
}

//
//
override protected function foo():void
{
   super.foo();
   //do stuff
   // get variable "x"?
}

I don't think you can, but it would save me some time if you could so I thought I'd ask anyway. My research seems to point to no.

Reading Local Variables In Remote FMS Application
How do read and display a variable from a local swf to a remote swf continuosly? For example, I have an swf that reads in XML data constantly on my local machine and I need to have a remote swf running off FMS display said data. Basically, if im logged into the remote app I can see the variable that hold that XML data from the local swf.

I looked into SharedObjects but can't seem to get this to work continuously, like a clock.

Thanks,
Gabe

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