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




How Do I Pass A Variable From...



..the main timeline to a loaded movie clip.

Layout: Main timeline contains audio voice over. Keyframes swap the value of silent from 0 (talking) to 1(not talking).

Movie clip is an 4 keyframe, 8 frame movie made to loop randomly. Frame 1 contains the mouth not talking, frames 3,5 and 7 have the mouth in various vocal positions (2 frames each mouth position).


In each frame of the movie clip I have the following script:

while (_level0.silence==0) {
var mouth=Math.round(Math.random()*3)
gotoAndPlay((mouth*)+1);
}
gotoAndPlay(1);

When I test the movie, I get an error message "A script in this movie is causing your computer to run slowly. Abort this script?"

Upon aborting the movie clip plays, but looping sequentially.

How can I fix this?? Tell me this is an easy one....



FlashKit > Flash Help > Flash Newbies
Posted on: 11-11-2002, 05:16 PM


View Complete Forum Thread with Replies

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

Can't Pass Variable
Hi,

I have a movie where I define a variable "botsim=20" in one of the first frames. Then, later in the movie I want to call this variable from a movieclip timeline by using it in something like "john=botsim+5". However the movieclip hasn't been able to call the "botsim" variable. Is it not possible to pass a variable from the movie timeline to a movie clip timeline?

Dan Riley

Variable Pass
Hi

I have several drag and drop movie clips which ask the User to place coded books (Dewey referencing code) onto numbered targets on a bookshelf.

I can program the movie so that it can check how many items are in the correct sequential order and gives the user three chances to get it right before loading the next movie clip.

What I am *desperate* to know is ... how do I keep a running score of correct attempts to be displayed at the end of the movie sequence?

*Any* suggestions would be appreciated ... I just need to carry the score from movie to movie (I think???)

--Rhi~

Pass Variable From JS To AS
Please Help!
Does anybody know how I can pass a variable from JavaScript to ActionScript (getVariable?)!
THX

Can't Seem To Pass A Variable Into Another Mc.....
Hey,

I'm experiencing a peculiar little variable problem:

I have a button:


Code:
on(release){
WinName = "lea";
_root.attachMovie("Gallery", WinName,559);
_root[WinName]._x = 200;
_root[WinName]._y = 200;
_root[WinName].ModelName = "lea";
this.NumThumbs = 5;
for (i=this.NumThumbs+1; i<=16; i++){
_root[WinName]["Thumb"+i]._visible=0;
}
}
this is the line i'm having trouble with:
_root[WinName].ModelName = "lea";

the "Gallery" clip attaches itself properly and receives this variable. And then the peculiar behaviour starts.

on the top layer, i use that variable to fill a text field. This works.

the layer below that, i have a movie clip which contains a button. the movie clip as:

Code:
onClipEvent(load){
this.ThumbNumber = 1;
this.ImageNumber = "01";
trace(ModelName);
}
the trace on ModelName comes up as undefined. I can't do a full path reference to the variable because the instance name of the clip is the same as ModelName.

it does work if i make ModelName a global variable, but that messes up the rest of the movie.

Any suggestions?
Cheers,
Ben

Pass A Variable
I have a button on a index.swf on level 1. I want this button to load awards.swf on level 2 and send a variable to awards.swf so that it opens at a certain point in a scrollable text.

I can get this to work if the variable value is set in awards.swf. Is it possible to send a variable value across different movies? If so, how.

Thanks

Robert

Pass Variable From One Swf To Another
hi

Well i am making a cd presentation in flash ...

i have 4 main movies(swf) with sound clips each has a mute button... if the mute button is clicked its stops sounds and passes a variable _root.check="off" ... but when i click on the link to other movies its gets enable again and the sound starts playing again ... i want this variable i.e _root.check to pass accross all the movie i click.

which means if i have click the mute button all the other swf files or movies i load should be muted...

please help me soon.

regards
kapil

ps deathline is tomm..

Boy, Do I Need To Pass A Variable
Okay~
so I started messin with the "menu dropdown" file included in Flash MX. Its the nice vertical heirarchy navigator with clickable entries. Its all controlled via an .xml file.

What Id like to do to make the interface more user friendly is to have it not collapse the menu items upon reload.

Each time the user clicks a link it reloads the .swf and effectively closes the section the user was looking at.

Macromedia uses this interface and theirs seems to remain open through page loads...anyone know how?

The link above is what Im working on. Its not complete so dont flame me for dead links, or errors.

Doug

Pass Variable Value From One Swf To Another
I have two swf's 1 and 2 and I want to pass a variable value from 2 to 1 while I load 1 over 2 in _level0.

Here is the code:

button in swf 2:
on (release) {
loadMovieNum ("miramarcd1.swf", 0, "GET");
}

variable in _root.main in swf 2:
from2=1;

actions in _root.main in swf 1:

if (from2) {
_root.main.slideshow.gotoAndStop(10);
}

What I am trying to accomplish with this code is when I press the button in swf 2 I load swf 1 in _level0 thus replacing swf 2. While doing this I want to pass the value of variable "from2" in swf 2 to swf 1.

This doesnt seem to work.

I Need To Pass A Variable From One To Another
I have an .swf with a few buttons. each button pops open a new html page with another .swf embeded in it. depending on which button is pushed, i need to pass a variable from the original flash file to the one that opens in the new window. I'm assuming this requires some javascript. can someone give me an example of how I can pass information from one flash file to the other? Thanks guys ...kuramu

Please Help Me Pass A Variable
I have an .swf with a few buttons. each button pops open a new html page with another .swf embeded in it. depending on which button is pushed, i need to pass a variable from the original flash file to the one that opens in the new html window.

I was trying the "myFile.swf?myNumber=26" thing to get the variable from html to the second SWF, but how do I use the first flash file to set that variable? Thanks

Pass Variable To PHP ?
Hi,

I want to know how to pass variable from Moive clip to PHP , I have a input text field inside the movie clip named "input" . i cant pass this variable to php ,if i put this field at root level (outside movieclip) it works fine .

please anyone know how to do it ,please help me

Thanx
Shan

Variable To Pass MC Name?
Im not sure what Im missing here or why I cant seem to target my MC's correctly..

but I have a few MC's on my stage...
example: frame_mc & tank_mc

They have this code inside of them:

Code:
stop();
this.onPress = function() {
this.startDrag();
focusClip = "tank_mc";
trace("focusClip is tank_mc");
};
this.onRelease = function() {
stopDrag();
};
and

Code:
stop();
this.onPress = function() {
this.startDrag();
focusClip = "frame_mc";
trace("focusClip is frame_mc");
};
this.onRelease = function() {
stopDrag();
};

Now I want to have some buttons rotate (and another set scale both x & y) the "focusClip"

But I cant seem to target it...
on my button I have this code:

Code:
on (press) {
focusClip._rotation += 5;
}
and

Code:
on (press) {
_root.focusClip._rotation += 5;
}

when I target by their individual instance names..they buttons work...however I would need a new set of buttons for each movie clip I click on...where I can just change the variable and use one set of buttons.


can anyone help??

Thanks

Pass Value To Variable
I don't know how to explain this in any easy way so please bear with me and sorry for the long text.

I'm creating a webpage where all the content is within the same swf. In order to get things to work I have all my different content in different MC's. Each of those separate MC's have two frames inside. One where it's empty and the other where the content is displayed. To make this work I have a variable name 'page'. My menu is supposed to pass a string to this variable and at the same time trigger a transition to be played ('doors' sliding over and hiding the stage). Then the transition sets all my content MC's to the hide position. Then it checks what the page variable is and sets the corresponding content MC to show before the 'doors' open again. At least that's how it's supposed to work in theory. But I haven't figured out how to do all this. First off I don't know how to get my menu to pass that string to the 'page' variable. Here's my menu with the problem area marked:
code:
stop();
// link variables
var urls = ['hjemFrm', 'guttaFrm', 'sponsorFrm', 'bussenFrm', 'http://gjestebok.nuffe.net/11668'];

// Button labels
var labels = ['HJEM', 'GUTTA', 'SPONSOR', 'BUSSEN', 'CHAT'];

for (var i = 0; i<labels.length; i++)
{
var btn = this['l'+i+'_btn'];
var mc = this['l'+i+'_mc'];
mc.textLabel.text = labels[i];
btn.defaultPos = mc._x;
btn.id = i;
// assign a lnk variable from the urls array
btn.lnk = urls[i];
btn.onRollOver = function()
{
var mc = this._parent['l'+this.id+'_mc'];
mc.targetx = this.defaultPos+9;
mc.dx = 3;
mc.onEnterFrame = moveMe;
};
btn.onRollOut = function()
{
var mc = this._parent['l'+this.id+'_mc'];
mc.targetx = this.defaultPos;
mc.dx = -3;
mc.onEnterFrame = moveMe;
};
btn.onRelease = function()
{
if(this.id==4)
{
getURL(this.lnk);
}
else
{
// PROBLEM !!!!
page(this.lnk);
}
}
}
function moveMe()
{
if (this._x == this.targetx)
{
delete this.onEnterFrame;
}
else
{
this._x += this.dx;
}
}
The other problem is, how do I get my menu to do nothing if it is on the page which button was clicked. The rest I think I might be able to do but if anyone wants to spell it out for me it would be grately appriciated. thx in advance guys.

Pass A Variable From An Swf To Another One
Hi
I'm Marco.
I have an html page named home.html; it embeds a flash movie named "1.swf "; When I click a button inside 1.swf :
--the variable "section" gets a value, for example section=1;
--this button links to another html page "main.html"

The main.html embeds a flash movie named "2.swf";
I would like that 2.swf gets the value of the variable section from the button clicked from 1.swf, which now is section=1;
how can I do it?

thanks
marco

[F8] Pass A Variable From Url
Hi,

Is it possible to use cutomized urls to create a personalized message within a flash movie? For example, lets say I send out a direct mail piece with a specific url for each customer (www.myurl.com/customer1) When they go to that url I want to pass that info to the flash movie so I can display a message like "welcome to my site customer 1, I'm glad you found us..." Any tips and pointers you can offer would be great!

Thanks in advance!

Pass Variable Name?
hi,

Anyone know of a way to pass or retrieve a given variables name?
example:


Code:
// myVariable is the thing to watch...
var myVariable:String = "variable value";

function displayVariableName(s:String){// here I get the value:
trace(" variable Value: "+s);// result: "variable value"
// here I would like to see the actual name of the variable passed:
trace(" variable Name: "+???); // would be: "myVariable"
}

// I pass the var to the function...
displayVariableName(myVariable);
I understand that I could make a function call of:


Code:
displayVariableName(myVariable,"myVariable");
but that's not what I'm after...

...any ideas?

thanks for any help.

Can I Pass A Variable From One Swf To Another?
Loader1.swf (var nav: is instantiated)- at the end of this it loads Loader2.swf.

Loader2.swf has 2 buttons. OnRelease of either here is what happens:

on(release){
nav="guyNav";
play();
}

then this is on the last frame:

loadMovie("loader3.swf", "_level20");
stop();


Loader3.swf has this on the first frame:
attachMovie(nav, "mainNav", 21);
mainNav._y=563;


So basically I need to attach a mc from Loader3.swf library and that mc is based on which button is hit in Loader2.swf.

Cant get it to work...is this possible. I have also tried many things like
_level20.nav="guyNav";
Loader3.swf.nav="guyNav";
_root.nav="guyNav";

can this even be done?

How To Pass Variable From MC To ASP
I have no form on flash but I am trying to extract color of some images on my flash movie and send it to ASP and database. When someone clicks on that movie it fills new color. I have extracted the color value by using getRGB() I have used Trace to see these values in output window.

Now how to send these values in ASP page so that I can put it into database?

Any help will be appricaited.

Pass URL Variable In And Out Again
Hi There.

I only started using flash a few days ago so this is obviously my first post.
Pass URL variable in and out again

I have built a banner ad manger system and it works fine with images, it basically
counts how many times the banner has been displayed and how many click thru's etc.

Now I am trying to develop it for Flash as well. I have done 90% and all is well. I have one
major stumbling block though.



I am passing in this variable <embed src="banner_ad.swf?BannerId=#BannerId#"

The banner will be displayed and the view added to the database so far now once the banner
is displayed it will have a url to the site it is advertising, problem is that the url
needs to be dynamic so I can count that it has been clicked on.

So in the nutshell the user clicks on the (Flash) banner it goes to a cold fusion page that updates
the database according to the BannerID coming from the flash banner, then it re-directs them to the
advertisers site.

I have this from what I have learnt in a few short days but it does not work.


EXHIBIT A:
on (release) {
getURL("index.cfm?fuseaction=display_redirect&esc= 1&BannerId=" + BannerId,"_blank");
}

Note: BannerID comes from the intial variable passed in to the flash movie


What my goal is is to have the link
index.cfm?fuseaction=display_redirect&esc=1&Banner Id="Variable Passed In" and _blank

Exhibit A is working but it only returns, the root of the site and the BannerID variable
I am losing everything from index to BannerID=

I GET: http://server/site/main/6

Can someone enlighten me please - in the mean time I will keep scouring and searching for the answer.

Cheer and thanks in advance - Garry

Pass Variable From One SWF To Another SWF
I am having difficulties passing a variable from one SWF to a dynamically loaded SWF.

I can get variables to pass into a SWF while using FlashVars in HTML. But in this case, I need to load the SWF file into another SWF file instead of directly via an HTML page & FLashVars. So now I can't figure out how to pass a variable from my main SWF file another SWF file.

// testA.fla AS code:
myText_txt.text = testVar; // this would display whatever I pass it when using FlashVars to set testVar in HTML

// testB.fla AS code:
this.createEmptyMovieClip("holder_mc", 0);
holder_mc.testVar = "Does this show up?"; // it doesn't show up
holder_mc.loadMovie("testA.swf");
//holder_mc.loadMovie("testA.swf?testVar='some thing i want to pass'");// doesn't work.

Any insight is appreciated!

Trying To Pass A Variable
I'm trying to pass the value picked from the color picker to a text field. I am attaching the .fla...

you will see that when you click on the color picker, it sets the color of the mc... I also want it to set the variable fcolor when picked.

the swf can be viewed at http://www.aulman.com/mxdab/ford0.html
if you just want to view the file first... the text down below should change to the hex # when picked...

Any help is appreciated...

Rev

<a href ="http://www.aulman.com/mxdab/ford1.fla"> fla here </a>

[MX] Pass Variable From 1 Swf To Another
Hello,

I have 2 SWF's on my website. They are separate though - not using loadmovie. I'd like to have my first SWF play and then trigger the 2nd SWF to play when the first one is done. How can I pass a variable from the 1st SWF to the 2nd? Is this possible?

Thanks

Foo

How To Pass Variable?
hi, I want to pass a selectedIndex as a variable over to another function so that the loop will follow whatever is being selected in the list.
I've tried using return variable;
it doesn't seem to be working though

I would like to loop the images in the following function by following the 'count' variable from the video playback.

for (var q=0; q<total; q++) {

image[q] = xmlNode.childNodes[count].childNodes[1].childNodes[q].firstChild.nodeValue;
image3[q] = xmlNode.childNodes[count].childNodes[2].childNodes[q].firstChild.nodeValue;
messages[q] = xmlNode.childNodes[count].childNodes[3].childNodes[q].firstChild.nodeValue;


}

firstImage();

} else {

content = "file not loaded!";

}

}

This is the video playback loop. Is it possible to loop the above image slidesshow function using the index of the video? Such as When video 1 is playing, I use the video index of 1 for the image slideshow to know which image it should show.

vidList.complete = function() {
if(seq.selected) {
if(count == list.length-1){
count = 0;

}
else {
count++;

}

}
else {
var temp = count;
while(temp == count) {
count = Math.floor(Math.random()*list.length);
}
}

vid.play(list.getItemAt(count).data);
list.selectedIndex = count;
list.getSelectedIndex();
trace(count);

}

really appreciate any help here. Thank you.

Want To Pass A Value To Variable...
init;
function init()
{
vx = x;
ball = attachMovie("ball", "ball", 0);
ball._x = 0;
ball._y = Stage.height / 2;
}

Using the above script i want to get the value from asp page and use for x using loadVariables().How its Possible...Please anybody give a immd solution...


Gnanavel

How Do You Pass A Variable
Ok so I have a movie clip, and have duplicated it to the stage many times. I gave each instance of the clip a different yet similar name, like so: row_0_0, row_0_1, row_0_2, row_1_0, row_1_1, and so forth. I'm only have a the problem of getting the variable that holds the each clips name to pass to become an object. here's the code. The code is on the each instance of the movie clip. thanks


Code:

stop();

var block:String;
var row;
var col;

this.onRelease = function() {

var nameArray = this._name.split("_");

for (var x = -1; x < 2; x++) {
for (var y = -1; y < 2; y++) {

row = parseInt(nameArray[1]) + x;
col = parseInt(nameArray[2]) + y;

if (row >= 0 && row <= 6 && col >= 0 && col <= 6) {

block = nameArray[0].concat("_", row, "_", col);
block.gotoAndPlay(2);
}
}
}
}

Variable Pass By Value
Hello,
I'm trying to take variables from an external php file and load them into flash. I got most of it working, however i'v ran into a few issues with passing my variables around.

First I declare my global vars on the first keyframe:

Code:
onLoad()
{
_global.thedata = new Array();
_global.anum = 0;
}
Then I run my copy function

Code:
onEnterFrame()
{
getdata();
sites_txt.text = _global.thedata[1];
}

Code:
function getdata()
{
l = new LoadVars();
l.onLoad = function()
{

for(i=0; i<15; i++)
{
_global.thedata[i] = this["result"+i];
}
}
I am able to confirm that the output from this["results"+i] is correct. I'm also able to check its entering the array _global.thedata[i] correctly (if I run some test after the for loop). However, in its current form setting the text box with the value of thedata[1] (after getdata() function) doesn't appear to be working. All I get is a clear input or sometimes an undefined. Could it be that _global.thedata[i] = this["result"+i]; is passing by reference, thus when the function scope deallocates, the original variables are deallocated with it. Is there a way to pass-by-value? or is there something else i'm missing.
Please come be my Link!
Thanks!

[MX] Pass Variable From 1 Swf To Another
Hello,

I have 2 SWF's on my website. They are separate though - not using loadmovie. I'd like to have my first SWF play and then trigger the 2nd SWF to play when the first one is done. How can I pass a variable from the 1st SWF to the 2nd? Is this possible?

Thanks

Foo

Pass A Variable
Good Morning All!

I am a newbie in Flash 8, ActionScript 2.0.  I need to pass a variable that was supplied to me via the URL through all my pages in Flash.  How can I do this?

Please Help!

Lladro

Pass Variable From HTML
I want to pass a variable from an HTML page to an SWF file that lives in a different HTML page.

Can anyone help me with this?

Thanks.

Can I Pass A Variable Into Flash With A URL?
i saw a site (although i forget the damn URL) that had "smart" flash nav- ie, it highlighted the appropriate section that the user was in. i checked the source on this to see how they did it, and it said
embed src="movie.swf?clip=1"
anyone have an idea of how to accomplish this? fs command is not an option since AFAIK it doesn't work in netscape.
thanks for any help!!

finn

Variable Pass Not Working?
Ok so here it is.

I have a movie that I am trying to control the playhead on through php and passing variables.

Basically the page has 6 links on it that look like this
http://www.domain.com/new.php?pageid=1 .... ?pageid=6

Now the script on my movie looks like this

loadVariablesNum ("http://www.bluesisblood.com/new.php?pageid=", 0, "POST");
if (pageid == 1) {
gotoAndPlay (27);
}
if (pageid == 2) {
gotoAndPlay (2);
}
if (pageid == 3) {
gotoAndPlay (52);
}
if (pageid == 4) {
gotoAndPlay (76);
}
if (pageid == 5) {
gotoAndPlay (81);
}
if (pageid == 6) {
gotoAndPlay (106);
}



I am by no means sure this is how I would do this but I am at a loss for another way. The problem I am having is nothing happens. It's like the variable isn't being passed at all...

Any help would be appreciated.

~N

How To Pass Variable From Asp To Flash
In a flash game, need to pass a session variable from an asp page to the flash file having the game. The asp page is loading initially in the flash file (loadvariable) and able to pass the points variable but not the session variable. Please help solve dis..

Pass Variable With Asfunction
HI, I am trying to pass the value i to the function videoWin from this HTML link. Right now it is passing i);

Thanks for the help


PHP Code:




for (i=0; i<dumpListLen; i++) {
        news.htmlText += "<a href='asfunction:videoWin, i);'>"+dumpXml.firstChild.childNodes[i].attributes.descript+"</a>";
}

How Do A Pass A Variable To With Java?
hello, I have the below code thus far:

-----------actionscript________
getURL("javascript:set_var()", "nav_main");

The function is below
-------------------------
<SCRIPT LANGUAGE=JavaScript>
function set_var() {
document.top.SetVariable("nav_location", "Test");
}
</SCRIPT>

>>>>>>>>>>>where in the actionscript can I put a varaible to pass to the javascript function????

Thanks,

[FMX] LoadMovie Pass Variable
I have had a look on here, and it seems that some ppl have tried to do a similar thing to what I am trying - but I guess that they had little, or no, success.

what I want to do is loadmovie a new swf into my video player
so.
vid.loadMovie("new.swf")

but I would also like to be able to pass some info to the player swf. (there are essentially a couple of different types of movie)

is it possible in any way? I have tried a number of things but without success - and my only remaining option is to use some kind of _proto_ variable - which I am also sure won't work.
I think that because if i set the _root._alpha of new.swf to 50 when it's loaded vid._alpha is 100 (despite the actual swf being at 50% alpha)

I should point out that this will not be deliverd by web, but locally, probably by cd-rom, to a machine.

Simple Variable Pass
Something simple although I don't have my book handy!!

Passing a parameter "part_name", which I want as a string, into a function, which will be part of targeting a movieclip.

function callOut(part_name) {
movieclip.[part_name].gotoAndPlay("on");
}


I have this on a button clip:
on (press) {
callOut(combustion);
}

Doesnt seem to be working.
Anyone?? Bueller?

How To Pass Variable From MC To ASP File?
I have a movie clip having a few buttons inside that Movie clip. User can click on each part and fill a color. I used getRGB() function to extract the filled color value of that button. I have used trace to see what the value is.

Now I want that value to transfer into a database using ASP. Can anybody please tell me, how to do that?

Any help will be appreciated!

Pass A Variable To Another Level
I'm trying to pass a variable from one level to another like this :

if (_level100.intro == home) {
gotoAndPlay(150);
stopAllSounds();
trace("your at the home page");
} else {
gotoAndPlay(2);
}

in level 100 I established the variable like this
on (release) {
loadMovieNum("subfiles/introduction.swf", 1);
intro = "home";
}

-BUT it doesn't seem to work
Any suggestions ??

Pass Variable Problem With MCs
Aloha its me again,

I guess I posted to long but I didnt know how else to do this so I will go one step at a time to find my way.

I have a orderform that is the main movie, and all those variable pass to the PHP file with no problem. I then made a calculator on its own time line by making it into a MC and put it on a layer in the form MC. How do I get the values that are calculated in that text box variable to pass to my form MC that its in on the Level0 so I can pass that on to the PHP file as well? I tried _globals, _parent, var=

but I am not sure if I am coding this right or not. I looked at so many passing variable threads and Im still clueless to what I am doing wrong

Bel

aka Datachic.... aka Sleepless in Hawaii
Quote:




I know so much more now about nothing.....

Pass Variable From A Row In The Datagrid
I got the the datagrid to populate and I got the cellPress listener to work. Now I need to pass a variable from differnt rows. How do I do this?

How Pass Image As Variable?
I know how to pass text into Flash using LoadVars, but how do I pass an image? I'm assuming I would just set the variable to the image path and file. But, the image control I was given to work with in Flash doesn't have a variable field lile a dynamic text field does.

Thanks for any help!

Ron Cook
Boulder, CO

[F8] Is It Possible To Pass A Variable Through A Pop Up Window?
Hey,

So here is my dilemma, I’d like a user to click a button on my movie clip and have it open a new html page with a login or signup flash movie Clip. Obviously the user can choose log in (send right to a password verification screen) or choose sign up.

The sign up page collects data and sends it through a php file. How can I record were the user originally came from.

Basically I’d like to use the same login./ sign up sheet for multiple sites and record which site they’ve come from.
Thanks in advance for any help or suggestions.

Pass Variable Problem
I want pass some url variables to flash, because the variables is divided by "&", and in the url variables also contain "&", how can I differ the
"&" in the url variables from the "&" between the variables.
I use AS3.0. thanks!

Pass Variable From MC To _root
Hi,

I have a movieclip that is loaded from the main timeline. Within that mc I have a button that when clicked I want to pass a variable back to a function within the main timeline.

The below bold string is what I want to pass as a variable from the button click event in the mc to the function LoadGallery in the main timeline.


Code:
Defines the xml path to pass to the function

function loadGallery1(){
loadGallery("Flash/gallery1.xml");
}


Calls LoadGallery function and recieves the xml path:

function loadGallery(galName){
_root.xmlDataPath = galName;
mcLoader.loadMovie("Flash/viewer.swf");
}


Calls function to run it:

loadGallery1();


All of the above code resides in the main timeline (_root), I don't show a button click event here from the mc because I don't have one. All I need that button click event to do is to populate that bold string above.

Can anyone help me with this?

thanks

[F8] Pass Out A Variable In A Function
Hey,

How can I pass out a variable from a function? So as to set the value of a variable in the same scope that the function was called?

For example (doesn't work...):

function save(vari:Number):Void {
vari = 50;
}

var big:Number;
save(big);
trace(vari);

So as you can see it doesn't do what I want it to do, as it traces undefined (which is expected...). It passes in "big", as vari, which is undefined, then sets it as 50. I don't want that though.

Hopefully you understand what I am asking.
Thanks in advance!

Can You Pass Variable From Within Function?
2 basic questions:
1. Can you pass a 'var' from within one function to another?
2. How do you do it???

Want to pass 'ObjectID' which is made up from a result value into the 'my3d' function. Doesn't register it at the moment?


Code:
public function cbPages(result:Object):void {
var objectID:String = result.title;
trace(objectID);
}

override protected function my3d():void {
cow=new Collada(objectID);
default_scene.addChild(cow);
}
Many thanks for your help in advance.

Pass String Variable Into XML ULR
I am trying to pass a variable through "strSource:String" so that i can dynamically tell the player to load different videos depending upon which page it is on.

This works:

Code:
var strSource:String = root.loaderInfo.parameters.playlist == null ? "includes/video1.xml" : root.loaderInfo.parameters.playlist;

function initVideoPlayer():void {

// create a new net connection, add event listener and connect
// to null because we don't have a media server
ncConnection = new NetConnection();
ncConnection.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
ncConnection.connect(null);

// create a new netstream with the net connection, add event
// listener, set client to this for handling meta data and
// set the buffer time to the value from the constant
nsStream = new NetStream(ncConnection);
nsStream.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
nsStream.client = this;
nsStream.bufferTime = BUFFER_TIME;

// attach net stream to video object on the stage
mcVideoControls.vidDisplay.attachNetStream(nsStream);
// set the smoothing value from the constant
mcVideoControls.vidDisplay.smoothing = SMOOTHING;

// create new request for loading the playlist xml, add an event listener
// and load it
urlRequest = new URLRequest(strSource);
urlLoader = new URLLoader();
urlLoader.addEventListener(Event.COMPLETE, playlistLoaded);
urlLoader.load(urlRequest);
}
Doesnt work if i try it like this:

Code:
var btnContent1:String = new String("includes/video1.xml");

var strSource:String = root.loaderInfo.parameters.playlist == null ? btnContent1 : root.loaderInfo.parameters.playlist;
Does anyone know why this is?

I can even put the URLRequest in as "includes/" + "video1" + ".xml" and it will work but as soon as i try to trade the "video1" for a string Variable it cannot find it.

My End hope to pass this variable through would be to have it on the HTML page where i could then dictate the exact path for the video XML

Code:
// source variables from HTML/js param
var btnContent1:String = root.loaderInfo.parameters["vOne"];
var btnContent2:String = root.loaderInfo.parameters["vTwo"];
var btnContent3:String = root.loaderInfo.parameters["vThree"];

Thanks for any help

will

How To Get A PHP Variable To Pass Into Flash
When you click a button in the movie or on another link on a web page you are taken to a web page that requires a session ID in the URL. I also need flash to take that variable and use it in my switch statement.

Thanks

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