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








Passing Variable


Hi,


I want to have a movie in level1 write variables to level0. I have tried several ways and none of them have worked. I'm not sure I know the proper syntax and have had trouble finding a complete reference on it. Here is what I'm trying right now:

In a frame script in level1 which is loaded into level0:

_level0.module = "netbas";

Then I have a button script in level0 use it this way:

on (release) {
loadMovieNum (+module+"_c.swf", 1);}

I want the button to load the following file into level1: netbas_c.swf. When I test and click the button I get an error that says it can't find "_c.swf" indicating to me that it isn't getting the variable value. It works fine when I set it within level0, but not from level1.

Can you please tell me why this won't work and what I need to do. Is there a better way to have links in level0 use variables that will be set in the current movie in level1?
Where can I get complete help on this?

Additional info: I have several movies that will be put into level1. A button in level0 will load a movie in level1. Once that movie is loaded, then I want all the navigation
buttons in level0 to have "netbas" in front of them so that they only load the swfs associated with the current movie in level1. Then when the user clicks on Advanced
Networking from the main menu and loads that movie into level1, I want all those buttons in level0 to have "netadv" in front of them. (i.e. netadv_c.swf). I hope this is
clear. I've made parts work, but I cannot get the variable to level0.

Thanks,

Brian




FlashKit > Flash Help > Flash ActionScript
Posted on: 06-14-2001, 11:04 PM


View Complete Forum Thread with Replies

Sponsored Links:

Problem Passing Variable Values (from XML) To Variable In Child Movie
I'm reading something from XML, and store it in a variable. I can trace the variable and it shows two items. I can display those two seperately with variable[0] and [1], meaning that it works as intended.

After that, I'm calling a movieclip, which is supposed to read that variable.. sadly, it can't do it. So I resorted to passing the content of the first variable to a variable inside the called movieclip. This works, and tracing the second variable shows both items from the first. However, I cannot access the items seperately with variable2[0] for example.

What's the problem? The second variable is currently a string. I tried to declare is as other things (like xml or array) as well, but that didn't help. Is there also a way to make this procedure unnecessary, i.e. can I somehow access the first variable?

I've attached the fla/xml/swf in case my description doesn't make sense!

View Replies !    View Related
Passing Array Variable Name In To Component Variable & Getting It's Value
Hi, All
Anyone can solve my problem????
My Problem is that I want to store a array' s name in to a component variable. like this:-

working in this case

Scene action on timeline
_global.arr = "This is aray Test"

component parameters
VarName : _global.arr



Not working in this case

Scene action on timeline
_global.arr1 = new Array()
_global.arr 1[0]= "This is aray Test"




component parameters
VarName : _global.arr1[0]




in component I'm doing this on timeline action
abc.text = eval(VarName)


plz help me out of this

Regards
Ankur Arora

View Replies !    View Related
Passing Variable?
i have a MC-b within a MC-a,i set a variable in MC a now i want to use it in MC b also how do i pass it on from MC-a MC-b or to main time line?
Thanx!

View Replies !    View Related
Passing Variable
I have a base movie. In this base movie I have loaded two other movie using the basic action:

loadMovieNum ("movie1.swf", 1);
loadMovieNum ("movie2.swf", 2);

I have identified and set variables in movie1.
[eg. _root.variable1 = "white";]

I would like to be able to change these variable from movie2.
[eg. _root.variable1 = "blue";]

I have not been able to do this.

Advice please.

View Replies !    View Related
Passing Variable
I have a base movie. In this base movie I have loaded two other movie using the basic action:

loadMovieNum ("movie1.swf", 1);
loadMovieNum ("movie2.swf", 2);

I have identified and set variables in movie1.
[eg. _root.variable1 = "white";]

I would like to be able to change the value of the variable from within movie2.
[eg. _root.variable1 = "blue";]

I have not been able to do this.

Advice please.

View Replies !    View Related
Variable Value Passing
I am trying to make an RPG in flash... I have a dynamic text box in the top left hand corner of each scene, to show how many credits the player currently has. The variable of that textbox is "showcredits". So I put in 2 actions:

credits = 500
showcredits = credits

In this game, people will be able to purchase things using the credits. But here is my problem. I have a seperate scene for a store in which they can buy things. In this scene, I have one action:

showcredits = credits

But in this scene, the number of credits doesn't show up... I'm guessing that the value I set for the "credits" variable in the first scene didn't pass over to the next scene... what can I do?

View Replies !    View Related
Passing A Variable To .SWF
I wonder if anyone can help me. This is probably a simple question for most of you but can I pass a variable into a .swf movie by simply doing this:

mymovie.swf?mapid=1

I would then like to collect the variables value within the flash movie. Is this possible or is there another way of doing it.

Thanks in advance

Steven

View Replies !    View Related
Variable Passing
I cant give up now im almost finish.But my problem is i cant pass a variable to php is some thing wrong with my coding
at flash
---------------------------------------------------------------
// Create random number to append to URL
randNum = Math.random()*1000000000;
var classID ="1"; >>>>this is the variable i want to pass to php
// Call PHP script to fetch class information
loadVariables ("viewforum.php?cla_id="add classID add "&" add randNum, this);
// Halt the movie clip until data loaded
stop ();
--------------------------------------------------------------

and here is my coding at php side
-------------------------------------------------------------
<?
// Include config file
include('common.php');

// Connect to database
$link = dbConnect();

// Build query to fetch forum
$query = "SELECT * FROM prod_subclass where cla_id= '$classID'";

// Execute query
$result = mysql_query($query);

// If query failed...
if (!$result) {
// Inform Flash of error and quit
fail("Couldn't list class from database");
}

// Find out how many class in this table
$threadCount = mysql_num_rows($result);

// Setup our variable to hold output
$output = "classCount=$classCount";

// For each classreturned...
for ($count = 0; $count < $classCount; $count++)
{
// Extract post details from database
$class= mysql_fetch_array($result);
$classID = $class['subcla_id'];
$topic = stripslashes($class['subclass']);

// Add thread details to output
$output .= "&class" . $count . "ID=" . $classID;
$output .= "&class" . $count . "Topic=" . urlencode($topic);}

// Output all threads in one go
echo $output;

// Inform Flash of success
print "&result=Okay";

// Close link to database server
mysql_close($link);

?>
-------------------------------------------------------------------


Please help ...thank you in advance

View Replies !    View Related
Variable Passing
I'm new to this. I need to pass a variable as defined in one script contained in a movie clip to another instance. The purpose of this is to have a drop down menu with button choices. Selecting a button will initiate a transition movie clip. When the last frame of the transition clip is viewed, a separate .swf file will begin loading. This same transition clip will be played before every linked .swf file is loaded. The name of the .swf is the variable I want passed from the menu to the tranisition clip.

I know it's wrong, but here's the code as it stands today. "movieOpen" is the intended variabe, of course used incorrectly here.



Drop Down Menu Clip Code:
on (release) {
_root.Transition.gotoAndPlay(2);
with (_root.Transition) {
_root.Transition.movieOpen = "Test.swf";
}
}



Transition Instance Code:
ifFrameLoaded (11) {
unloadMovieNum (3);
loadMovieNum ("movieOpen", 3);
}
stop ();



Thanks in advance for your tutelage,

Todd

View Replies !    View Related
Passing A Variable To A URL
Hi,
I am having difficutly figuring out how to pass a variable from an input text field to a URL. I have a form field for users to input their zip code, then I would like to append the a url to add that zip code. The URL ends with "zip= " and I would like to input the zip variable before executing the getURL command. Any thoughts?

Best

View Replies !    View Related
Passing Variable From One Swf To Another
How do you pass a variable from one swf to another?

View Replies !    View Related
Passing Variable Help
little syntax help please :

var fadeButton = 2;
_root.button(fadeButton)._alpha = 50;

trying to make button2 fade 50%....not working...whats the proper syntax.

THANKS!

View Replies !    View Related
Passing Variable From URL To SWF
I am creating a small SWF of a speedometer. The end result should take the value of a variable "speed" from the URL and have the needle of the speedometer stop on a corresponding frame. There is 160 MPH on the speedometer and the needle goes from 0-160 over the course of 160 frames. I have gotten the needle to work using a slider (please excuse the jumpy-ness).

http://www.blackdragonmotorsports.com/speed.htm

Now that I have gotten that to work, I need to replace the slider with a dynamic variable (from the URL) that will tell the MC "needle" to stop at the corresponding value. For example...if the URL was:
http://www.blackdragonmotorsports.c...ed.htm?speed=45
the needle should stop on frame 45.

The *.fla is at http://www.blackdragonmotorsports.com/speedometer.fla

Any help would be awesome.

Thanks,
Jay Almers

View Replies !    View Related
Variable Passing
Hi expert out there, need some help from you guys, so here is the situation, i have a html file which content 2 frames FRAME1 and FRAME2, how do i pass variable(onclick or onload) from HTML in FRAME1 to the flash(swf) in FRAME2 to do something? Is this posible?

Thanks in advance!!!!

View Replies !    View Related
Variable Passing
*is there anyway that you can pass variables from one movie clip to the another.
Say i have a in one movie clip/button
on(press){
if(t=true){
gotoandplay("blah");
}
else{
gotoandplay("blah2");
}

can i update that variable t in another movie clip and pass it to the one that has the code above?????
is it even possible?

thanks
Peter

View Replies !    View Related
Passing Variable
howdy

i have three swf's main, nav, and window now what im tring to do is when a button is clicked in nav set variable in root i have this action, not sure if its right

_root.section="home";

i declared this variable in the main.swf, i have the following code:

section="0"; in the first frame of main

now when i click the button in nav as well as sending the variable to _root i get it to start anination in window which is doors shutting, when they finally close there is the following actions

if (_root.section == "home") {
loadMovie("pages/home.swf", "_level2.contentwindow.msg");
} else if (_root.section == "work") {
loadMovie("pages/work.swf", "_level2.contentwindow.msg");
} else if (_root.section == "skills") {
loadMovie("pages/skills.swf", "__level2.contentwindow.msg");
} else if (_root.section == "gallery") {
loadMovie("pages/gallery.swf", "_level2.contentwindow.msg");
} else if (_root.section == "contact") {
loadMovie("pages/contact.swf", "_level2.contentwindow.msg");
} else if (_root.section == "msg") {
loadMovie("pages/msg.swf", "_level2.contentwindow.msg");
}

cant seem to get them working, been playing with the code for ages now, pulling my hair out.

thanks in advance

View Replies !    View Related
Re: Passing Variable
Hello,

I am having some trouble passing a variable from an input box to a dynamic text box. I want the user to input their name, click a submit button and then have their name passed to a dynamic text box. At the moment I have an action on the button as follows: -

on (release) {
inText = grad_Name;
gotoAndStop("output");
}

(grad_Name is the name of the variable attached to the input box, to be passed to a frame named "output".)

The action on "output" frame is as follows: -

outText = inText;
stop();

(outText is the name of the dynamic text box).

Now, it was working OK but then I adjusted a graphic and now it doesn't work!!!

Any ideas or a better solution much appreciated.

View Replies !    View Related
Passing Variable
I have an variable called "myVar" in my flash movie level 0. Now I want to pop up a new flash movie in a new window, and also need to pass this variable to this pop up new movie. How can i implement this? Any method that I can use to pass this variable in Flash thru different window? thx

View Replies !    View Related
Passing A Variable From A URL To SWF
Hello. I've recently learned how to get javascript to pass a variable into flash. What I'm trying to find out is, how do I take it one step further and get it to pass variables from the url itself? What I mean is something like:

flashpage.html?variablename=value

Where a javascript takes this information and turns it into a variable, somehow. So for example, one could make a dynamic flash birthday card, with the user's age and name passed through a url from a link so whenever Joe, age 23, clicks on it, he's greeted with an animation saying "Happy 23rd Birthday, Joe!" For example.

Anyway any help you can offer would be appreciated.

View Replies !    View Related
Passing In A Variable
Right now I am I have a moive that loads another movie in it. It loads different movies based on a variable that gets passed in on the html page like this MyMove.swf?whatmovie=TheTitleMoive.swf. The problem with passing the variable in with the URL is that the browser does not cache the movie.

I have been trying to use the loadvariables() function to do the same thing. I can load a variable and have it displayed into a text area but when I try to use that variable to load a movie the variable does not work for some reason.

Does anyone have an exaple of how to do this or a tutorial?

Thanks

View Replies !    View Related
Passing Variable From Src Into SWF
GOAL: To pass a variable from the param/embed html code into the .swf file so that by changing the external variable, it is possible to display different stock market indices in a spectrum format.

EXAMPLE SWF: http://www.finwin.com/template.cfm?n...ode=218&view=1

I created the above DTN Market Spectrum flash movie to display moment by moment trends in various stock market indices.

Now I want to create individual displays of the same data so that clients can select which index they wish to view instead of all six. In order to do this, I want to create a single, generic movie that can be used for any of these six and others we might create. The key is to pass the name of the chose index from the param/embed source into the actionscript for the movie.

Here's what I am doing currently:


<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="400" height="72" id="dow30spectrum" align="middle">
<param name="allowScriptAccess" value="sameDomain" />
<param name="movie" value="mSpectrum.swf?indX=dow30" />
<param name="quality" value="high" />
<param name="bgcolor" value="#ffffff" />
<embed src="Mspectrum.swf?indX=dow30" quality="high" bgcolor="#ffffff" width="400" height="72" name="mspectrum" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object>


The variable is <b>indX</b> and the index I am wanting to display is the Dow 30 (dow30).

THE PROBLEM:
While the variable is being passed into the Mspectrum movie (I set up a temporary dynamic text field to display the value when I run the movie), my actionscript isn't recognizing it.

My movie is set up with two layers. Layer one is essentially the "stage" on which are some graphics and dynamic text fields for displaying price and volume data. Layer two is an attached movie that builds the spectrum through a loop process. It reads the values for each company displayed in the index and defines the width and color of each company's spectrum element.

If I hardcode indX in layer one to equal "dow30", the spectrum works as predicted. But if I try to use the external value passed in from the ?indX=dow30 in the param/embed code above, I get 'undefined' values and the spectrum won't build. Yet, I can see the "dow30" in the temporary text field I've created in layer one.

I know this sounds pretty complicated, but basically the code is not passing the externally-hardcoded value for indX from layer one to the attached movie, but it will when indX is hardcoded in layer one.


Anyone have any suggestions on passing the external indX value to various parts of this movie?

Thanks

View Replies !    View Related
Variable Passing
I am trying to pass variables using ASP to a swf file that is located within the same page.

Example:
I have a dynamically generated URL that is posted in the body of an email. When the person clicks on that URL it opens a web page that contains a link to another ASP page that contains a swf ( we'll call this asp page myvars.asp).The link to myvars.asp passes variables into the page from a query string. It is these variables that I want to pass to the swf. I can not simply call this page from Flash again as the variables being passed are dynamic based off of the query string.

I hope this makes since. I no how to pass variables to and from Flash from an ASP page, but since these variables are dynamically generated off of a link, I don't know if it is possible to do what I am trying.

Thanks,

FWagner

View Replies !    View Related
Passing A Variable
Hi:

I am creating a website. I need to pass a variable from one flash movie using getURL action. Is it possible to do that? Let me explain my problem in little detail.

I have home page. It has 5 Menu buttons. When you click one of them, it opens a seperate swf having a navigation bar. I need to use a same navigation bar(swf) for every click on home page but the swf for nav bar should jump on the different frames according to the button clicked on the home page.

Can anybody help on this matter?
Thanks

View Replies !    View Related
Passing Variable Value
Is it possible to pass a variable's value to the gotoAndPlay(); function. I'm having trouble with a condition statement and I just want to skip that step and set a variable to pass the lable name to the gotoAndPlay. i.e. gotoAndPlay(Variable);

View Replies !    View Related
Passing A Variable To An Swf
<*PARAM NAME=movie VALUE="text_anim.swf?sect=section3"*>

Will this work in all browsers and all platforms if I place it in the object and the embed tag.

View Replies !    View Related
Passing A Variable To A Swf Via A URL?
Let's say I have a swf with a variable name of "number" that I'd like to be able to set via the url, such as:

http://www.domain.com/page.html?number=4

How do I set up the swf/html to allow this?

Many thanks.

View Replies !    View Related
Help With Passing Variable
Hi guys I hope some one is up I don't get what I am not doing right here.

I am using flash MX by the way.

I have a main movie or a shell the loads another movie into which contains a
navigation bar, images etc.

The navigation bar is in a movie clip, each button is also its own movie
clip as well.

In the second movie that's loaded I have this action script:


Code:
_global.section;
//setProperty("_level0.Lall.adbt", _visible, "0");
//this = function() {
if (_level0.Lall.mainmenu.about.section == "about") {
trace("about was hit");
//setProperty("_level0.Lall.adbt", _visible, "100");
tellTarget ("_level0.Lall.adbt") {
gotoAndStop(2);
// getURL("vision.swf", "_level2");
}
} else if (_level0.Lall.mainmenu.port.section == "portfolio") {
trace("portfolio was hit");
tellTarget ("_level0.Lall.adbt") {
gotoAndStop(3);
// getURL("vision.swf", "_level2");
}
} else if (_level0.Lall.mainmenu.serv.section == "services") {
trace("services was hit");
tellTarget ("_level0.Lall.adbt") {
gotoAndStop(4);
// getURL("home.swf", "_level2");
}
} else if (_level0.Lall.mainmenu.con.section == "contact") {
trace("contact was hit");
tellTarget ("_level0.Lall.adbt") {
gotoAndStop(5);
// getURL("portfolio.swf", "_level2");
}
//} else if (section == "home") {
//getURL("audio.swf", "_level2");
}
//};
// end if
stop();


Now is my about button I have this action script.


Code:
on (rollOver) {
_level0.Lall.mainmenu.about.gotoAndPlay("begin_about");
}
on (press) {
_level0.Lall.mainmenu.about.section = "about";
buttonsound_open = new Sound(this);
with (buttonsound_open) {
attachSound("button_sound_S");
start();
}
}


The problem is the it wont trace and also when uploaded to my site it will
not work.

Can any one help me?

Thank you.

View Replies !    View Related
Passing A Variable..
Hello,
I have a problem with this part of my script. The maxRows variable is received from a .cfm page. The problem is that the maxRows variable is not set it's value. So I have a situation like IF (3 == maxRows) instead of IF(3==3).


if ( flashid==maxRows ) {
flashid = 1;
gotoAndPlay (2);
} else {
gotoAndPlay (2);
}

Thanks for any help.

View Replies !    View Related
Passing A Variable From One Swf To Another
I have made a 2-part presentation that will be shown on a company's internal website. All employees will see Part 1, and all managers will see Part 1 followed immediately by Part 2. They will access the presentations by clicking on a link on a page that's sent to them by email.

My idea was to make a swf for each of them (employees and managers) which would just contain a script to create a variable ("man" for managers and "emp" for employees) and then launch Part 1. Then, at the end of part 1, it would look to see what the variable was, if the variable was "man" it would go on to Part 2, and if the variable was "emp" it would close the player.

I tried this but it seems that a variable gets lost when a new movie is loaded. I tried loading it to level 1 but it still didn't work. Any suggestions or is there just no way? (other than having 2 separate copies of Part 1)

View Replies !    View Related
Variable Passing
I don't know if I am overlooking something simple, but I can't find the solution anywhere.

I have a main timeline, on which some variables are declared. I then have some movie clips on the timeline, which I want to manipulate based on the variables from the main timeline.

My problem is that I can't pass the variables from the timeline into the movie clips. How can this be done?

Thanks.

(using Flash 8 Professional)

View Replies !    View Related
PLEASE Help Passing Xml Value As URL Variable
I am using a combo box that is populated by an xml file that looks somewhat like this..

<hotellist>
<hotel>hilton</hotel>
<hotelid>1</hotelid>
</hotellist>


I have had success passing the <hotel> as a variable in the url by using mycombobox.text because its the actual text of the selected item.

But I am having problems sending the <hotelid> variable. anything I try is 'undefined' - any help with this would be much appreciated.

Thanks

View Replies !    View Related
Help With Passing A Variable From......
Hello,

I usually try to seek out my answers rather than ask for help, but I have decided to try and put away my pride and ask. I am working on a flash project in which I have seperated into different swf files in order to keep my loading times down. In one section of my project a user clicks on a button that loads a seperate swf file containing the requested information. When the user is done reading the information they can click on a button called "Home" which will direct the currently loaded swf file to advance to and play a frame label designated as "fadeout." At the end of this there resides a final frame(keyframe) which I want to call a variable that is created on the first frame of the main timeline of the flash movie that loaded the external swf movie that I am trying to call from.
The reason why I am wanting to do this is because I want to have my external flash movie unload itself after the fadeout frame has finished playing. The problem I am having is that I cannot figure out how to target the timeline of my original movie. I know that in as2 you could use _level0 correct? However, from my understanding this has been elimanated in as3. I hope that I have clearly made my point across.

Sincerely Grateful,
Stephen E.

View Replies !    View Related
[MX] Variable Passing From Mc To Mc
Good evening everyone

I am trying to pass a variable between movie clips and I am having some trouble.

I have created a loop which cycles through some ml and collects everything which is ticked yes, once this is done it compiles everything into an array, this array then has a number which should be passed between the movie clips.

The xml is used at the end of a sequence, once the sequence has been played I would like the mssage to be displayed, then next time around loop through the messages list to play another and so on until the messages are back to the start.

Any help on this matter would be much appreciated, as its been doing my head in for a couple of days now.

I know that my variable i am trying to pass around is getting overwritten, however my knowledge of actionsript is not quite up to scratch yet.

My xml looks liks this
Code:
<screensaver_config>
<message active="N">
<imagePath>i/one.jpg</imagePath>
<text>1</text>
</message>
<message active="Y">
<imagePath>i/two.jpg</imagePath>
<text>2</text>
</message>
<message active="N">
<imagePath>i/three.jpg</imagePath>
<text>3</text>
</message>
<message active="N">
<imagePath>i/four.jpg</imagePath>
<text>4</text>
</message>
<message active="N">
<imagePath>i/five.jpg</imagePath>
<text>5</text>
</message>
<message active="Y">
<imagePath>i/six.jpg</imagePath>
<text>6</text>
</message>
</screensaver_config>
Thanking everyone is advance for their help

cameron

View Replies !    View Related
Passing JS Variable TO An SWF.
The swf calls a popup window to browse files on the computer, and once the user browses, I want to pass the path back to flash. I've checked flashVars, but those are only loaded when the movie loads. FSCommand sends messages to javascript, but I don't see where it can recieve command/args FROM JS.

Thoughts? It would be crazy to create an xml file just to pass this path into flash. Surely there's a better way?

Can't attach the flash file. Sorry. I just want to know how to pass JS variables into Flash.

View Replies !    View Related
Passing Variable To PHP
I tried to make an input box (variable name was input) and a submit button. When you clicked on the button:


Code:
button.onPress = function(){
getURL("http://danditcamp.com/stuff/dctetrisscore.php?name="+input, _self, "GET");
}
But instead of going to http://danditcamp.com/stuff/dctetrisscore.php?name=Mike (or whatever I put in) it puts in stuff like the font and font size. Is there any way to get around this?

View Replies !    View Related
Odd Variable Passing
Please check out the zip file included, it is an example of what i am talking about.

I have run across something that i can not explain. This worked in prior versions of flash so i am confused at how this is happening. If anyone has any insight i would love to find out why this situation of passing information dynamically in to text fields and trying to access the text field returns an "undefined" variable; although the content is displayed the variable does not exist.

the way in which the content is sent to the text field is:
_root["someMovie_" + increment + ".myTextField"] =
"Show Me";

Check out the zip file it contains an example of what i am talking about. It is setup with a button that traces the variable and displays what is in the text cell.

When you run the flash file, the variable is visible within the Text field but is Not accessible by any statement to retrieve the variable.

View Replies !    View Related
Variable Passing
Hi guys, how are we??

I have a flash file, and i want to send one field to another page.

its called email, the field that is, and i want that to go to the next page in a query string, How do i do that, this is what i have so far:

ActionScript Code:
on (release) {
    getURL("http://www.returnity.com.au/returnity_2005/email.rsp?email=", 0, "GET");
}
that is on the button

thanks

View Replies !    View Related
Passing Variable
Hey There All!

Okay - been working on a project FOREVER & Im almost to the point where it's going to work but I need some serious help....

This is what I have so far.... (the notes are from another forum - not trying to cross post, I was just in the wrong place before)


Code:

// then where ever you are setting your variables do:
sender.id=#url.id#;


// send the id value to your cfm page using sendAndLoad, and returned xml will be loaded into the xml object x.
sender.sendAndLoad("info1.cfm",x,"GET");

};
and

Code:
var x:XML=new XML();
x.ignoreWhite=true;x.onLoad=function(done){
if(done){
trace('xml file is now loaded into '+this);
// now that it is loaded, process it the way you want.
};var sender:LoadVars=new LoadVars();
The problem ... you cant actually put #url.id# in actionscript - I need to identify the ID and then (so I've been told) it will be passed w/ the link to the cfm file as a url.id.

The question:
How do I make that sender.id dynamic based upon the url.id fed to the swf?

AKA

the url
somecoolsite.com?id=something_dynamic

the swf
gallery.swf?id=something_dynamic

the sender.id NEEDS TO BE
sender.id=something_dynamic;

so that the the files in the cfm page will be dynamically generated based upon that url.id & therefore the correct images will show.

*** yeah, I know I've put xml information in a cfm page - the .cfm is not messing up the xml or the flash... if I hard code the images into the .cfm page flash is fine w/ it... it's just passing the variable that's got me stumped.

View Replies !    View Related
MC To MC Variable Passing
How do we set a variable in a Flash movie clip that was just loaded by the 'master' movie?

View Replies !    View Related
Passing Variable
Hi,

I have 2 swf files. I have a button on one of the files which open the other file. I am trying to pass a variable from file 1 to file 2 to filter the results in file 2.

How would I set up the variables in both files so that when the button is clicked, it opens the second file with the correct ID number?

Thanks heaps.

View Replies !    View Related
Variable Passing
hi
i wana pass variable from 1 flash file to another flash file :(

View Replies !    View Related
Passing A Variable
Learning MX syntax... coming along fine until:

I have an swf setting a variable in one level, and I want to be able to include that variable as the target for my loadmovie to load into...

I've set the variable in _level15 (name of the target), and I want to load 1.jpeg into that target (variable set in _level15) which is in _level40...

How do I pass it to level40?

Rev

View Replies !    View Related
Variable Passing..
Hey,

I have used the kirupa tutorial for passing variables to a flash file, which in theory all makes sense, however my code only appears to partially work.. this if from frame 1 of the movie:

if (movie=="" or movie==1) {
_root.section = "image1.swf";
}if (movie==2) {
_root.section = "image2.swf";
}if (movie==3) {
_root.section = "image3.swf";
}else {
_root.section = "intro2.swf";
}

It'll load image3.swf if i use myfile.swf?movie=3 but any other variables will result in the else running (even no value). Any idea what is going on here?

Cheers,
dft.

View Replies !    View Related
Passing Variable To Php To Xml
I am using phpObject to save info to an xml file.
I cannot seem to pass the variable $tilePath to the xml and i get:
<TILE PATH="" />

all the other nodes get populated:
<?xml version="1.0"?><LEVEL><ROW><CELL type="2" /><TILE PATH="" />

Is my php code wrong? or is it my actionscript?
i tried:
tilePath[p] = "ttttteesssttt";

but i still get the same result of ><TILE PATH="" />


here is my code:


Code:
// Initialize array storages
var gameArray = new Array();
// Iterate through the rows in reverse
for (var gH:Number = (level.gridHeight - 1); gH >= 0; --gH) {

// Create new secondary array
gameArray[gH] = new Array();
// Iterate through the columns in reverse
for (var gW:Number = (level.gridWidth - 1); gW >= 0; --gW) {

// Get name of the tile
var myName:String = tileName(gW,gH);
// Get current setting of tile
tileType = _root.origin[myName]._currentframe;

// Add to data array
gameArray[gH][gW] = tileType;
// Initialize array storages

var tilePath = new Array();
tilePath[p] =[];
// Get path (imgloc2) of the tile
if (_currentframe=="2")
{var tilePathy:String = _level0.imgLoc_01;}
else if (_currentframe=="3")
{var tilePathy:String = _level0.imgLoc_02;
} else if (_currentframe=="4")
{var tilePathy:String = _level0.imgLoc_03;
} else if (_currentframe=="5")
{var tilePathy:String = _level0.imgLoc_04;
} else if (_currentframe=="6")
{var tilePathy:String = _level0.imgLoc_05;}
// Add to data array
tilePath[p] = tilePathy;}
}



and my php code:


Code:
<?php

class Leditor {

function Leditor() {
$this->init();
}

function init() {
}

// Save game tile array as an XML file; called from Flash function saveLevels()
function levelSave($filename, $gameArray, $tilePath) {

// Construct XML data into a string
$saveVal = "<?xml version="1.0"?><LEVEL>";
foreach ($gameArray as $row) {
$saveVal .= "<ROW>";
foreach ($row as $cell) {
$saveVal .= "<CELL type="$cell" />";
$saveVal .= "<TILE PATH="$tilePath" />";
}
$saveVal .= "</ROW>";
}
$saveVal .= "</LEVEL>";


// Strip out any attempt to access other directories,
// as a mild protection against PHP hackers
$temp = explode("/", $filename);

// If the filename doesn't end in 'xml', add it to the end of the file name
$temp = explode(".", end($temp));
$fileSuffix = strtolower(end($temp));
if ($fileSuffix != "xml") {
$filename .= ".xml";
}

// Save it to the desired file
$datafile = @fopen($filename, "w+");
@fwrite($datafile, $saveVal);
fclose($datafile);

}


// Update file directory listing; called from various places in Flash
function levelListing() {

// Clear file list
$this->localFiles = array();

// Open the local directory
$levelDirectory = opendir(".");

// Read each file name
while ($filename = readdir($levelDirectory)) {

// Deconstruct the file name to get the file suffix in lowercase
$temp = explode(".", $filename);
$fileSuffix = strtolower(end($temp));

// Only add to list if it ends in 'xml'
if ($fileSuffix == "xml") {
$this->localFiles[] = $filename;
}
}

// Close directory
closedir($levelDirectory);

// Sort list alphabetically
sort($this->localFiles);

}


// Delete chosen file name
function levelDelete($filename) {

// Strip out any attempt to access other directories,
// as a mild protection against PHP hackers
$temp = explode("/", $filename);

// Only delete if it ends in 'xml'
$temp = explode(".", end($temp));
$fileSuffix = strtolower(end($temp));
if ($fileSuffix == "xml") {
unlink($filename);
echo $filename . " deleted.";
}

}

}

?>

Thanks!!!

View Replies !    View Related
Passing Variable From One Fla To Another
Hi,

I have integrated a swf into another swf.
(Actually it is a menu that I have incorporated in my 'main swf'.)
When clicking a button in swf no.1 (the menu) I set:

_global.new_value="1" ;
_root.Application.newfunction();

-and then in swf no.2:

function newfunction(){

trace(_global.new_value);

}

I get nothing, just: "undefined".

How do I pass a variable ?
Do I have to use asp or the like ?

best regards

View Replies !    View Related
Passing A Variable From One Swf To Another
hey guys,

I'm trying to pass a variable from my main swf to another one that's being loaded in a container in the main swf. What I usually do is create that variable in the main swf and have the loaded swf fetch it but in this instance I need the loaded swf to have it's own root.


ActionScript Code:
container._lockroot = true;container.loadMovie("main.swf");if(_root.lang == "french") { trace("french was pressed"); container.lang = "french";}else { trace("english was pressed"); container.lang = "eng";}


If a trace lang in my main.swf I get undefined. Any ideas on what I can do?

View Replies !    View Related
XML Variable Isn't Passing... Please Help
Hey all, my first post here and it is in regards to the slideshow tutorial here and I am at a loss as to why I can't get the "linkto" variable to pass through past the firstImage() function. If you see the problem please let me know, here is the code:

Code:
delay = 5000;
//-----------------------
function loadXML(loaded) {

if (loaded) {
xmlNode = this.firstChild;
image = [];
linkto = [];
total = xmlNode.childNodes.length;
for (i=0; i<total; i++) {
headline._visible = false;
description._visible = false;

headline[i] = xmlNode.childNodes[i].childNodes[0].firstChild.nodeValue;
linkto[i] = xmlNode.childNodes[i].childNodes[1].firstChild.nodeValue;
description[i] = xmlNode.childNodes[i].childNodes[2].firstChild.nodeValue;
image[i] = xmlNode.childNodes[i].childNodes[3].firstChild.nodeValue;
}
firstImage();
} else {
content = "file not loaded!";
}
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("source.xml");
/////////////////////////////////////
listen = new Object();
listen.onKeyDown = function() {

if (Key.getCode() == Key.LEFT) {
prevImage();
} else if (Key.getCode() == Key.RIGHT) {
nextImage();
}
};
p = 0;
this.onEnterFrame = function() {
filesize = picture.getBytesTotal();
loaded = picture.getBytesLoaded();
preloader._visible = true;
text_background._visible = false;
if (loaded != filesize) {
preloader.preload_bar._xscale = 100*loaded/filesize;
} else {
preloader._visible = false;
text_background._visible = true;
if (picture._alpha<100) {
picture._alpha += 10;
textcover._alpha -= 10;
}
}
};
function nextImage() {
if (p<(total-1)) {
p++;
if (loaded == filesize) {
picture._alpha = 0;
textcover._alpha = 120;
picture.loadMovie(image[p], 1);
description.text = description[p];
headline.text = headline[p];
linkto = linkto[p];
picture_num();
slideshow();
headline._visible = true;
description._visible = true;
button_mc._alpha = 0;
this.button_mc.onRelease = function() {
getURL(linkto);
}
}
}
}

function prevImage() {
if (p>0) {
p--;
picture._alpha = 0;
textcover._alpha = 120;
picture.loadMovie(image[p], 1);
description.text = description[p];
headline.text = headline[p];
linkto = linkto[p];
picture_num();
headline._visible = true;
description._visible = true;
button_mc._alpha = 0;
this.button_mc.onRelease = function() {
getURL(linkto);
}
}
}

function firstImage() {
if (loaded == filesize) {
picture._alpha = 0;
textcover._alpha = 120;
picture.loadMovie(image[0], 1);
description.text = description[0];
headline.text = headline[0];
linkto = linkto[p];
picture_num();
slideshow();
headline._visible = true;
description._visible = true;
button_mc._alpha = 0;
this.button_mc.onRelease = function() {
getURL(linkto);
}
}
}
function picture_num() {
current_pos = p+1;
pos_txt.text = current_pos+" / "+total;
}
function slideshow() {
myInterval = setInterval(pause_slideshow, delay);
function pause_slideshow() {
clearInterval(myInterval);
if (p == (total-1)) {
p = 0;
firstImage();
} else {
nextImage();
}
}
}
Thanks so much for any help!

View Replies !    View Related
Passing Variable From MC To MC
hello all, i have a "campus map MC" that is an attachedmovie clip linked from the library to a scrollpane on the main timeline. there is a "info balloon MC" in the "campus map" with a "close" button on the info balloon that hides the balloon.

the campus map has buttons over each bldg. on rollover/rollout the "info balloon MC" appears and disappears. if you click the button it 'stays' and the button is disabled so that the rollover/out stop.

button code:


Code:

on (rollOver) {
setProperty(this.bubble,_visible, 100); // info balloon MC nested in the campus map MC
setProperty(this.bubble,_x, 200);
setProperty(this.bubble,_y, 50);
}
on (rollOut) {
setProperty(this.bubble,_visible, 0);
}
on (release){
setProperty(this.bubble,_visible, 100);
btn1.enabled = false; // btn1 is name of button
_global._global.actv_btn = "btn1" // var sent to the close button
}
what should happen:
click a building button...info balloon pops up and button is disabled. 'close' button is clicked on the info balloon. info balloon disappears. button is re-enabled.

everything works except the last step of re-enabling.

i know the code works cause if i hard code the button name the re-enabling works.
i know the var with the button name is successfully passed using trace()
but replace the hard coded button name with the variable and nothing happens.

my 'close' button code(frame scipt):


Code:

close_btn.onRelease = function() {
sp = _global.actv_btn;

this._parent[actv_btn].enabled = true; // one method i tried

//_root.main_scroller.spContentHolder.sp.enabled = true; // another method

setProperty(_root.main_scroller.spContentHolder.bubble,_visible, 0);

//trace(sp) // actually equals "btn1" but the code still won't work!
}

any ideas?? thanks!

View Replies !    View Related
Variable Not Passing
I know this should be simple but I can't figure it out for the life of me.


Code:
for(i=0;i<xmlLength;i++){
mainMenu.createEmptyMovieClip(xml[i].attributes.n,mainMenu.getNextHighestDepth());
mainMenu[xml[i].attributes.n].createTextField(xml[i].attributes.tf,this.getNextHighestDepth(),0,yPos,50,15);
mainMenu[xml[i].attributes.n][xml[i].attributes.tf].html = truel
mainMenu[xml[i].attributes.n][xml[i].attributes.tf].htmlText = xml[i].attributes.n;
mainMenu[xml[i].attributes.n]._y = yPos;
yPos+=10;

mainMenu[xml[i].attributes.n].onRelease = function(){
pl = xml[HERE].attributes.dl;
funcSite(pl);
}
}//end for
on the line pl = xml[HERE].attributes.dl; i want to replace here with the var 'i' that is being created by the for loop. I have tried just putting 'i' there. any thoughts?

View Replies !    View Related
Passing A Variable
This is one of my probs that I would like to know...

I have a tween class as below and rather than repeat the same tween class for several itmes i have I would like to pass the name of the mc to a tween function but not having much success:
heres what I would ideally want:


Code:
mcclip.onRollover = function(){
tweenFunction("theMc.moveMc");
..some code
}

function tweenFunction(theMcID){
var mcName:String = theMcID;
var newYPos:Tween = new Tween(theMcID, "_x", Regular.easeOut, 0, 100, 3, true)
}
Now ideally I want 6 btns that will call just this one tween function and simply passing the name of the MC's that I need to tween etc.

but also later on I would like to also pass in the start and end pos with variable as well so I can re-use the function for tweening etc.

But its giving errors etc.

I hope this made sense,and many thanks.
Look out for my next tween issue.

View Replies !    View Related
Help With Variable Passing
How do you go about passing a variable from the main movie to another movie loaded in level0?

I want to click a menu item which accordingly loads a new movie in level0, basically replacing the original movie, while going to a specific frame in the new movie as specified by whichever button was pressed in the previous movie. Hope that makes sense.

View Replies !    View Related
Copyright © 2005-08 www.BigResource.com, All rights reserved