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




Setting Variables From ASP Querrystring



Hi,

I'm trying to learn how I can pass parameters from a querystring to flash. The reason is so that I can create one menu bar that highlights the current page rather than build hundreds of menu bars - one for each page.

Does anyone know any tutorials or may be able to help?

Thanks

James



FlashKit > Flash Help > Flash General Help
Posted on: 12-04-2003, 06:20 AM


View Complete Forum Thread with Replies

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

Open A Querrystring Need Backup Now
Hey boys and girls!!

I need help now.......

I have built a banner with a form and a button. I want that button to send the variabel to an url, like a querrystring.

on (release) {
getURL("http://www.url.com/search.html=variabel", "_blank");
}

Solution???

Thankful for a quick reply!!

Best regards

//Andreas

Setting Variables
Hi, I'm having some problems getting variables to work. I have a movie clip and an invisible button which I am trying to make interact with that movie clip. I wish to make the movie clip play from frame 2 to 5 when it is rolled over. On rollout, it reverts back to frame 1. When it is clicked, it plays from frame 6 to frame 10, and stays on frame 10 until another action from another clip tells it otherwise, meaning no matter if you click it or rollover it again, whatever. I am unsure of which command to set the variable to activate. Here is my code:
on (rollOver) {
set (press1, true);
if (press1==false) {
_root.about_movie.gotoAndPlay(2);
}
}
on (press) {
set (press1, true);
if (press1==false) {
_root.menu1.gotoAndPlay(6);
press1 = true;
}
}
on (rollOut) {
set (press1, true);
if (press1==false) {
_root.menu1.gotoAndStop(1);
}
}

Setting Variables In URL
Hello All,
I am attempting at making dynamically loaded URL's for my dynamic buttons in flash mx. I have this issue: Is it possible to place a variable in the "URL" field of the "GET URL" browser function? If so, how? I have come up with the following code with no success.

Frame 1 actions
test = "http://www.google.com";
stop();

Dynamic button actions in Frame 1
on (release) {
gotoAndPlay(5);
}

Frame 5 actions
getURL("test");
stop();

I believe my problem lies in the "qoutes" around my variable "test" in the "getURL" field. I cannot remove them, flash puts them in there when I type anything in the URL field.
Any other suggestions on how to due this please reply.
Thank you
Steve

Setting Variables Right?
on (press) {
set (count, 1);
+count;
if (count>10) {
_root.gotoAndPlay("78");
} else {
gotoAndPlay ("64");
}
}


I think i did this right but I'm not sure, I'm new to AS myself.

I want the code to count the number of times you click on a button, but it doesn't see to be working.

I'd like it to play a specific part of the game(frame 78) if the button is clicked 10 times, but p[l;ay a different part(frame 64) if it's any less that 10.

Everything seems to work fine its just that when you goto click the button just once it restarts the movie. Any help?

Setting Variables? Again...................
Ok, this is my setup:

I press a button which both sets a variable frame (if i click home, frame = "home", if i click about,frame = about etc). The button also takes me to my transition out scene.

My transition out plays and the last frame says gotoandplay(frame)

My content frames are labled "home", "about" etc respectively so after the transition plays I should go to the right frame but I don't go anywhere.

Shouldnt this work? I thought so but my scripting isnt too good....
any help would be much appreciated
cheers
lev

Help With Setting Variables
I'm making a simple game and i wanna know how id make it so that when i click on a key (and make it dissapear by moving it's frame up by one, movie clip) and then click on the keyhole on a box it will change frames and appear to have opened

right now, if you click on the keyhole before getting the key it says "get the key first" but when i get the key it still keeps saying that

here in the code i have on the keyhole:

on (release) {
if (_root.lockedbox1 = 0) {
with (this) {
gotoAndStop(3);
}
} else {
with (this) {
play();
}
}
}

and this is what i have on the key:

on (release) {
lockedbox1 = 0;
with (key1) {
play();
}
}

can anyone help?

Setting Variables?
Hey, how would you use variables?

Completely nubish but yah... So am I..
But that's alright that's OK thats why I'm on this forum anyway

Setting Variables
Hi,
I have a quick question.

Okay I'm building this demo website, and I'm loading and unloading swf files as needed.

I ran into a small problem.

I have a Naviagtion (nav.swf), loading into _level3.
That I want to interactive with another (test.swf), in _level7.

In test.swf, it's a simple background change. My first background change is:

var bgImage = 0;
if (bgImage==0) {
_level7.bkMc.gotoAndStop(1);
}
This seems to work fine.

Now in my nav when I click one of my button, I want it to change the value to 1,2,3 etc....

So if I add the second part of it it will recongize the new variable and make the proper bk change.

var bgImage = 0;
if (bgImage==0) {
_level7.bkMc.gotoAndStop(1);
}
if (bgImage==1) {
_level7.bkMc.gotoAndStop(2);
}

So on and so forth. How do I do this?
I have been trying everything but I can't seem to find the right syntax.

Setting Variables In AS?
will someone please tell me how to assign variables in flash? I was guessing it'd be just like php but I think I'm wrong... I tried just $variable = blah; and then blah($variable); but it doesn't work

I'd be happy with just a link to a tutorial even..

Thanks for your time.

[F8] Setting Variables And IF Help
Hi,

I have two objects, two squares for example, square1 and square 2.

I'm trying to make it so that select just one and then you can rotate them using one set of rotate controls. Rotate controls consisting of 2 mc's to rotate CW and the other CCW. CW is rotateCW. and CWW is rotateCWW.

Code for the rotation (on frame) which makes square 1 rotate. But Here I want it so i can select it and then rotate it.


Quote:




rotateCW.onPress = function() {
square1.onEnterFrame = function() {
this._rotation += 3;
};
};




So I thought by making a Dynamic text box and calling it 'object' so when you click or roll over square1 or square two it changes the value inside it then you can apply an IF function to the rotation code above?

Code to set variable in Dynamic text box.


Quote:




square1.onRollOver = function():Void {
_root.object = "square1";
}




But I can't get this IF code to work. At the moment I have this


Quote:




rotateCW.onPress = function(){
if(_root.object = "square1")
{
square1.onEnterFrame = function() {
this._rotation += 3;
}
}
}




This does work, and makes it rotate but when you click the rotateCW. it changes the variable ('object') to square1 as well?

Any better ways or ways this can be fixed?

Thanks

(MX 04 Pro) Setting Variables For An Mc
What i need is to set some values for a few movie clips and then use them all at once. Eg, i'll have 5 mcs in my movie, each with either variable = 1 or variable = 2 etc assigned to each of them differently. Then i want to run some code kinda like

if (the variable on mc_one < 4){
do some stuff
}

Im not sure if im going about it the right way, but i think its fairly obvious what im trying to do. Thanks in advance for your help. Merry Christmas, Happy Hanukkah, Happy Sunday etc etc.

(MX 04 Pro) Setting Variables For An Mc
What i need is to set some values for a few movie clips and then use them all at once. Eg, i'll have 5 mcs in my movie, each with either variable = 1 or variable = 2 etc assigned to each of them differently. Then i want to run some code kinda like

if (the variable on mc_one < 4){
do some stuff
}

Im not sure if im going about it the right way, but i think its fairly obvious what im trying to do. Thanks in advance for your help. Merry Christmas, Happy Hanukkah, Happy Sunday etc etc.

Setting RGB Of Mc's Using Variables
Hey,

Just joined the forum here, but already i want to pillage your minds, apologies. I'm redeveloping the website at http://www.thebmbgroup.com. Different sectors of the company have difference associated colours. This is all crap you don't need to know.

What the problem is, when you click on different links in the main navigation, I am to be able to make various assets around the website change colour, according to an RGB value stored either on the mc holding the link or on my database running the site. For argument sake a i'll show some specific code:

onClipEvent(load) {
label = "Newmedia";
tipText = "blah, blah, blah";
myColour = "0xFFCC00";
}

Now, when we come to give certain assets this colour, how do we go about it? I'm trying various methods at present, here is my code at the moment:

fillColour = new Color(fill);
outlineColour = new Color(outline);

fillColour.setRGB(0xFFFFFF);
outlineColour.setRGB(parseFloat(myColour));

The problem I think I have, is that the setRGB needs a hex number argument, but I am presenting it with a string, does anyone with experience in this (or not) have any possible soloutions?

Thanks for your time and patients.

Cheers

John

Luton, UK

Setting And Calling Variables.
I am more of an animator than a programmer--someone send me to a tutorial or somewhere that could explain how to do what I need to do.

If you click on my homepage link it'll show you my page. What I would like to do, is set up one button under the preview window, that will send you to the full page html link of the swf that is currently showing in the preview window--but this setting variables has me buggered. I've set the page up so that the buttons on the left load a swf in the "menu" area, and the thumbnails in the menu area load into a blank target movie clip on the root timeline.

Is there anyway to set a variable that would change each time a swf is loaded in the preview window, that I could call with the send button, that would take the viewer to the fullpage html page. The easy way would be to put a button at the end of each swf that could call the html--but I really don't want to have to upload all these files again.

I've had complaints from viewers that the title text is too small. You don't need to write the code for me, I am willing to do some homework--but I've been everywhere I can think of and I can't find anything that relates.

Setting Flash Variables
i was wondering if it was possible to set the _currentframe of an MC by using setting it like a variable???

like this

setVariable: "/mc:_currentFrame" = 5;

this particular code does not work... i was just wondering if anyone knew a way to do it this way... i'm not to skilled in flash4 actionscript

Trouble With Setting Variables
Hi All,

I thought I had the concept of variables OK, but there is a problem for me in one area.

In a game, (or anything for that matter!) I have a movieclip (meter) that contains a second movieclip (guage)whos _y position is increased by a certain amount, depending on what has been hit, this I am achieving with various buttons that have the code:
on (press) {
_root.meter.guage._y += (whatever value needed);
}

That works fine, however, I then want to:

a) display the new _y position of the second movieclip in a dynamic text box in the main stage,

b) set a variable with the new _y postition that can be used to ensure in the next scene the second movieclip (guage) starts in the place it was left by the previous scene, rather than starting back at the beginning position.

This is where I'm coming unstuck. I dont seem to be able to pass the variables around. I tried setting a variable in the _root, then sending it a new variable with an onClipEvent (enterFrame) on the second movie clip, but couldn't pass that to the next scene or to the dynamic text box.

Anyone see where my understanding goes pear-shaped??!!

Cheers,
Dongle

Really Easy, Setting Variables
hi

i have a bunch of variables in a php script that i need to load in my SWF in the first frame. each variable is a physical attribute of a particular MC. everything else works...right now my code looks like this:

imageMC._x = ixpos;
imageMC._y = iypos;
imageMC._rotation = irotation;
imageMC._height = iheight;
imageMC._width = iwidth;

it doesn't work though...am i writing the variable part right? let me know if you have any ideas! thanks!

Setting Color Variables...
Hello,

Is there a way for me to set a variable for color? I have a swf file with a variable. I am loading the data externally for the variable text field. The text field has a color applied to it in the Flash App itself through the text options palette.

Can I define the color for the dynamic text through a variable. If so, how do I set it up(in Flash as well as the external file)?

Thanks in advance!

Vince

Don't Know What To Call This, But Please Help About Setting Variables, I Think.
Hey,

I'm trying to make this thing, its like a secret code changer thing. For example if I type the letter a into the box i would like to be able to press a button it will output the message into another box as another letter. This would be like a secret code changer. I hope you can understand what i am trying to do.

If i type A into the input B will be printed in the output.

What code would i need to put on a button to do this.

Thankyou for your help and Happy New Year

-turner2000

Help With Setting Movieclip Variables
Howdy --

I have a movieclip on my stage, instance name Test.
The movieclip has a text field, called _TTest_.
I successfully modify the text field, a la:
_root.Test._TTest_ = "New Text";

Ok. Now, I want a bunch of duplicates of that movieclip.

for( i = 0; i < 10; i ++ )
{
sname = "test_" + i;
duplicateMovieClip( Test, sname, i + 100 );
}

When I do this, I can't seem to then modify the
text field in the duplicate movieclip.
If, in the loop, I do something like
_root.sname._TTest_ = "New Text" + i;
or whatever, well, that doesn't work of course.

I've even gone nuts and tried stuff like this:
var Tests = new Array;
for( i = 0; i < 10; i ++ ) {
sname = "test_" + i;
Tests[i] = new MovieClip;
Tests[i].duplicateMoveClip( Test, sname, i + 100 );
_root.Tests[i]._TTest_ = "test";
}
...which, of course, doesn't work.

I'm trying to modify text fields in duplicated movie clips,
how do I do that?

Any help would sure be appreciated, as I've run out of
crazy things to try...

THanks

Rob

Setting Variables Not Equal To Zero?
Ok, I'm kind of (totally) new to actionscript.
I've decided to try to learn on my own by blundering my way through a lifesim-style game. So far, so good... Until I tried entering variables that don't start out at 0.

("money"=200), etc.

The problem is, no matter what I set them at, the variables always start out in my game at 0. Also, at 0, they don't show up in the dynamic text boxes (they start showing up once I do something that gets them above zero, though... Just the number 0 doesn't show up.)

Any help would be really, truly appreciated, I'm trying to learn as much as I can on my own but occasionally I come to an obstacle I just can't get around... I've been trying to figure this out for 2 days now (I know, not a long time, but it's a major roadblock.)

PLEASE HELP ME!!!

Setting Variables Using A Button
Okay, here's what I need to have happen.

I have a picture album. When a button is clicked, I want it to give a certain value to a variable and then go play a movie clip of a "page turning", and then assign the movie clip an action at the end of the page turn that says if that variable equals "this", then go and play a certain frame in the main time line. Then different buttons will each play the page turn and then go to a different frame according to what variables I assigned them.

I seem to know what I want to do, and I tried it myself, but I'm not sure what I'm doing wrong. Here's my first code for the first button:

on (release) {
a = "1";
gotoAndPlay ("turn");
}


Then my movie clip of the page turn has this on the last frame:

stop ();
if (a=1) {
tellTarget ("/") {
gotoAndPlay ("Scene 1", "page2");
}
}


Can anyone help??????

Setting Variables From One Clip To Another
Hello, I have variables located at
Variable _level0.instance2.players0 = "Austin, Paula"
there are many players, this is just the first in the list. What I am trying to do is to take these variables from this movie clip instance and insert them into another movie clip
at _level0.data2. I am a tad confused about the correct syntax to make the variables available to the data2 clip. Could someone point me in the right direction?

Searcher

Setting Dynamic Variables
Lets say you load 2 variables from a text file named 500troom and 501troom. There's already a a variable called room that's set to 500. What I'm trying to do is make a text field that calls the values of 500troom or 501troom. The tricky part is that I need it to do it dynamically so that if variable room equaled 502, then the text field would call variable 502troom and vice versus when room equaled 500 then the text field would grab 500troom.

SO, in my head it looks like text field variable = room+"troom". But that spits out 500troom in the text field not the value of 500troom that was imported from the text file.

Hopefully this isnt confusing and someone can help me.

Setting Multiple Variables With 'if'
hi all,

I need some hlp here with some basic syntax...I know what I am trying to do, just not sure how to do it right...

I have an MC listening for a variable to be passed from a button on the main stage. I have it working with one variable, but not with multiple. In this case, it is a dynamic text box that I am trying to make display different files depending on the variable...here is what I have tried:

---------------------------

if (Number(_root.nav) == 1) {
loadVariables("1a.htm", this);
} else if (Number(_root.nav) == 1){
loadVariables("2a.htm", this);
}

---------------------------

seems to be not hearing the second variable for some reason...any help?

thanks!

-Damage

Trouble With Setting Variables
Ok, hopefully somebody can help me out.
I'm pretty new to actionscripting but i'm positive what i hope to accomplish can be done.

I'm trying to create a slide menu, which only allows one section to be open at once.
ie, if menu 1 is open and menu 2 is clicked then menu 1 slides closed then menu 2 slides open.

i figured the easiest way to do this would be to use a few variables to specify what is opening and already opened and use the variables to direct the timeline to various movie clip symbols based upon the variable values set by clicking on buttons.

Unfortunately, for the life of me, i can't seem to figure this one out, and everything i have tried doesn't play like i think is should.

So i guess my major question is how do i properly go about setting variables? and secondly, is this a feasible idea? i forsee the use of 2-3 variables total to get the effect.

any help would be greatly appreciated and suggesstions as well
thanks all!!

Latz-
Money

Setting Variables For Components
I've tried playing, or fooling, around with the combo box component and I still can't figure out how to set a variable for it. Can anyone help me?

Setting Variables Dynamicly In MX
In flash 5.0 the following syntax was accepted for setting the variables x1, x2 up to say x30
to "nn1", "nn2,....."nn30", respectivly:

for(i=1;i<31;i++)
{
eval("x"+i)="nn"+i
}
This would assign x1 to "nn1" and so on.

But in MX you are not allowed to use eval on the left side of "="
How is this "problem" solved here?

Setting Variables To No Value & Detection
I'm trying to set a mouseover effect with a variable, which on mouseover is assigned a value and on mouseout to no value, and have a movieclip detect if there is a value (to start the mouse over animation) and no value (to end the animation)...What I've go so far in the button is:

on (rollOver) {
_root.mouse = "whoweare";
_root.whoweare.mouseover = "yes";
}
on (rollOut) {
_root.mouse = "void()";
_root.whoweare.mouseover = "no";
}

setting the value and then clearing it...is that correct?
then in the animation movie clip:

if (_root.mouse != "services" && _root.mouse != undefined) {
gotoAndPlay ("mousehide");

which "seems" to work...

and

if (_root.mouse == undefined) {
gotoAndPlay ("mouseshow");
} else {
gotoAndPlay (45);
}

which doesn't work. What did I do wrong?

Setting Variables? Quite Basic I Think...
lo all. i have 4 pages all based on the same template but with a different colour and different title. i have a transition page which i want to be displayed differently depending on which pages are 'sliding in' and out. so, what i need is a script on my button which will set a variable to alter the colour and the title of my transition page.
Thx for your time
Lev

Setting Variables? Quite Basic I Think...
I posted in actionscript but as more people seem to browse here thought i may have more luck...
cheers
lev

http://www.flashkit.com/board/showth...hreadid=422714

Setting And Checking Variables
Bottom layer has 3 keyframes with (the same) 3 buttons in each.
these make the main timeline switch between the 3 frames.
But not just like that...

In layer above are 3 movieclips,.. 1 per (key)frame.
These are the submenu's...

frame 1 to 15 fade-in
(key)frame 15 is the usable submenu
frame 16 to 30 are fade-out

Now the 3 main-timeline butttons should instead of just switching frames.. tell the menu to fade out first...

I avoided variables here by making several fadeouts of the same menu with different goto's at the end.

But here it comes//...

The Submenu calls on the real content... the fourth movieclip with the instancename SCREEN.
And now the point is ... If this screen is active then i want to tell target THAT to fade out first before i just right away target the submenu.

I found out that if i press a button to activate the SCREEN i can in the same mousepress also SETVARIABLE 2 fields ... this i can stilll barely grasp.. but how i should check on the variable and then go do either this or that ???

I know the Setvariable is okay cause the other one only works in the timeline it is stated right ?


If you've actually read all this... THANX A LOT !!!
really...

Setting Variables W/ Buttons?
Hi all,
I'm new to actionscripting and I humbly ask for any help:
I am building a meu system that has multiple states and will utilize variables to set the 'menu states' here is the plain english version of the code that I'm having trouble
here is a link to the menu I am trying to control: sliding menu
I would like the user to be able to click a letter and have the corresponding menu expand and stop. I would like the user to click any other letter which would cause the currently expanded menu to collapse and in turn expanded the menu that corresponds to the button the user just clicked.
I figure the best way to do this would be to set two variables:
menuState = (which would correspond to a label on the timeline, eg: c_menu_expanded)
and then a button action that would check the current menuState, perform the proper collapse action and then proceed to perform the proper expand action.
I understand setting switch variables and this seems to be the way to go, but it's assigning the variables initially that I'm having trouble with.
Does this make any sense? I have a feeling I'm making this more complicated than it needs to be.
thank you
Adam

Buttons Setting Variables
I'm not sure what to call it, but I'll do my best to explain. There are three buttons, and when clicked, they all end up at the same frame. Now, on the frame they end up on, how do I make the actions of the frame depend on which button was clicked? For example, if I click the first button, I want the actions of the frame it ends up on to go to Scene 1. If I click button 2, I want the actions of the frame it ends up on to go to Scene 2, etc.

I'm guessing it's something to do with variables. Maybe have button 1 set a variable to 1, button 2 set the variable to 2, etc. Then, when it gets to the frame, I do a little "if" statement, asking if the variable = 1, then go to Scene 1, and if the variable = 2, then go to Scene 2, and so on. The only thing is, I have no idea how to do this. Could anybody write up the actionscript for me on these conditions? Thanks!

Setting / Checking Variables
I don't know actionscript very well at all, but I know exactly what I need to do, and I know for a fact that it can be done. I'm just not sure how to write it out. Here's what I'm trying to do:

---

When the movie starts, I want to create a new variable on the first frame. Let's name it "sectionVar" just for the heck of it.

Now, later in the movie, there will be buttons to set this variable. If button 1 is clicked, then I want it to set the "sectionVar" variable to 1. If button 2 is clicked, then I want it to set the variable to 2, and so on.

Lastly, in a certain's frame actions (a frame that appears after the variable is set), I want it to check what "sectionVar" is set at, and perform an action according to the setting. For example, if sectionVar = 1, then gotoAndPlay(100). If sectionVar = 2, then gotoAndPlay(200), and so on.

---

Basically, I just need the coding to create a variable (in frame actions), set a variable (in button actions), and check what a variable is set at, and perform an action according to the setting (in frame actions).

Hopefully I explained this well enough, and if what I'm thinking it can do is completely wrong, then this will be a little embarassing, heheh. I'd really appreciate any help as soon as possible. Thanks!!

Problems With Setting Variables....
hi there,

I've been making a mailing list which uses FormMail and it works fine apart from the missing field verification. I've created an 'error' movie which tells you of the missing fields. This is the code I have on my 'send' button:
Code:
on (release) {
if (fullname=="") {
error.gotoAndStop("fullname");
}
if(email=="") {
error.gotoAndStop("email");
}
if(tel=="") {
error.gotoAndStop("tel");
}
else{
loadVariablesNum("http://www.MyURL.com/cgi-bin/formmail.cgi", 0, "POST");
error.gotoAndStop("thankyou");
}
}
but because I do not know how to set the variables, the 'error' movie does not show the correct 'missing field message'. Instead it just goes straight to the 'thankyou' message.....

Here is the .fla, if you can help me out with this predicament, I would be very grateful.

Cheers.

Setting Variables Question (MX 2k4)
this may sound weird.. due to they way i may explain it
but i'll try to explain than paste some code.. and hopefully some1 can help me out.

what im trying to do:
i have 4 buttons, and a background movie.
the bg Movie is an animation of a landscape going from morning-daytime-evening-nighttime
the 4 buttons are supposed to control the time of day accordingly.. what i have done is.. set up a movie clip with four frames
and made it so everytime i clicked a button it would go to a certain frame on that movie clip...
than in the _root i set the variable bgframe to be what frame that movie clip is on:

//bgframe = (_root.bgcontrol._currentframe)//

next i tried to set each keyframe in my Bground movie to do this:

//if(_root.bgframe = 1)
stop();
else
play();//

and do that four times with frame 1-4

my problem is i set a dtext box to monitor my variable.. and it doesn't work.. everytime i click one of the buttons it just says 1, than 2, than 3, than 4, and its not instant it waits for the background to get to the next keyframe and stop (which it always will)
so i dont think the variable is working.

does anyone think they know whats wrong.. i can post the .fla on some webspace if need be.

Setting Variables With LoadVars
I have a class enemy which extends movieClip. When instantiated onstage it is supposed to load up some variables using loadVars. The variables are retrieved from a .txt file. So far so good. But the variables I set in the loadVars onLoad function will only stay set while in the loadVars onLoad function. Once I'm out of that function my variables return 'undefined.'
Here is the code in the class:

code:
function Enemy() {
var lvlData = new LoadVars();
lvlData.load(level3.txt);
lvlData.onLoad = function(bSuccess) {
if(bSuccess) {
_root.enemy3._myTeam = this.sMyTeam3;
trace(_root.enemy3._myTeam);
}
}
trace(_root.enemy3._myTeam);
}


Now I've used a number of different ways to try to set those variables, and called them in different ways too, but no dice.
The trace in the if(bSuccess) loop will return the right value, but the one outside the loop will not.
This is currently killing me, and any help would be greatly appreciated.
Richard

Help With Quiz And Setting Variables
I am working on a quiz that loads random external .swfs into an invisible movie symbol and I want the user to press a button as an answer and than hit submit where if the answer matches the external swf than go to frame("correct") or if wrong go to frame ("tryagain"). I am stuck on how to make the external swf have an variable value and how to set it equal to the answer...So far this is my script:

in frame1:

code:
//declare buttons variable
var useranswer:Number;
var answer:Number;


on each button:
code:
//set variable useranswer to value of 1
on (release){
set (useranswer, 1);
}


on the invisible_mc:

code:
//checks to see if the external swf letter1.swf is loaded. if so than
//set var answer's value to 1. or if letter2.swf is loaded than set it to 2.
//if neither is loaded that go to frame "quiz"
onClipEvent(load){
if (letter1.swf){
set(answer,1);
}else if (letter2.swf){
set(answer,2);
} else {
gotoAndStop("quiz");
}
}


on submit button:
code:
//checks to see if var useranswer's value is equal to answer's value
//if it is then go to "correct" frame. if not then go to "tryagain"
on (release) {
if (useranswer == answer) {
gotoAndStop("correct");
} else {
gotoAndStop("tryagain");
}
}


I am thinking that the code on the invisible mc shouldn't be there but I am no t sure where I am suppose to place it.
I am going insane figuring this out and could use help.
Thanks
Samantha

EDIT: Added [ as ] tags for readability - jbum

Setting Dynamic Variables
I have set up a "for" loop that I would like to have set the alpha for a number of variables. I know I can set a variable this way:


Code:
_root.treeListenerFront.treeListener1._alpha=0;
And I know I can set a dynamic variable using an array:


Code:
for(i=1; i<=32; i++){
_root["treeListenerFront.treeListener"+i]=0;
}
But I can't seem to use the second method to set the alpha value. For instance, the following isn't working for me:


Code:
_root["treeListenerFront.treeListener"+i+"._alpha"]=0;
What is the best way to go about doing this?

Thanks, in advance.

Setting And Then Checking Against Variables?
Hey there. I've been trying to figure out how I could somehow create an "if then" statement with variables for my website.

Basically I just want to have a button that checks for a certain variable when you click it (I want it to check if a movie, lets call it "movie1" is already loaded). If it comes back false, then movie1 and movie2 both get loaded.

This way, after movie1 is loaded for the first time, it wont be loaded again. Basically, movie1 is just my background for all my other movies. So clicking button1 for the first time would load movie1 and movie2. Clicking button2 AFTER button1 was clicked would only load movie3.


Got it? Problem is, I'm limited in my knowledge of actionscript and variables, so I need some help (actually, lots of help, as I dont even know where to begin) to get this working. Thanks!

[F8] Setting _global Variables
Hi There,

I am having troubles setting _global variables.

As you can see at the top of my code I set my global variable...

_global.isImgLoaded = 0;

Then further down the code on the click of a button I attempt to set it to 1...

navProjects.onRelease = function(){

_global.isImgLoaded = 1;

But my onEnterFrame = function(){trace(isImgLoaded)} still says that the global variable is 0 and my code doesnt work accordingly.

How can I set the global variable "isImgLoaded" when I click the "navProjects" button???

Thanks for any help!

Jordan





----------------------

onEnterFrame = function(){
trace(isImgLoaded)
}

_global.isImgLoaded = 0;

stop();

var navEasing:Number = 0.2;

var layoutEasing:Number = 0.5;

function navEase(theClip, targ) {

var dy:Number = targ - theClip._y;
var vy:Number = dy * navEasing;
theClip._y += vy;
}

function ease(theClip, targX, targY) {

var dy:Number = targY - theClip._y;
var dx:Number = targX - theClip._x;
var vy:Number = dy * layoutEasing;
var vx:Number = dx * layoutEasing;
theClip._y += vy;
theClip._x += vx;
}

//Place the menus off the stage


navProducts._x = -1000;
navProducts._y = -1000;
navInfo._x = -1000;
navInfo._y = -1000;


//Main Nav About Sections


navAbout.onRelease = function(){

navProducts._x = -1000;
navProducts._y = -1000;
navInfo._x = 0;
navInfo._y = 17;
navInfo.gotoAndPlay("in");

if(_global.isImgLoaded == 1){
_root.mainSite.mainNav.productShots.gotoAndPlay("o ut");
}

onEnterFrame = function(){
ease(_root.mainSite.layout.layoutGroup, 0, 208.05);
navEase(navAbout, 0);
navEase(navProjects, 67);
navEase(navContact, 84);
}
}

navInfo.navPhilosophy.onRelease = function(){

onEnterFrame = function(){
ease(_root.mainSite.layout.layoutGroup, 0, 208.5);
}
}

navInfo.navMission.onRelease = function(){

onEnterFrame = function(){
ease(_root.mainSite.layout.layoutGroup, 0, -319.9);
}
}

navInfo.navFormunion1.onRelease = function(){

onEnterFrame = function(){
ease(_root.mainSite.layout.layoutGroup, 0, -848.8);
}
}


//Main Nav ProjectsSections


navProjects.onRelease = function(){

_global.isImgLoaded = 1;

navProducts._x = 0;
navProducts._y = 35;
navInfo._x = -1000;
navInfo._y = -1000;
navProducts.gotoAndPlay("in");

_root.mainSite.mainNav.productShots.gotoAndPlay("f u");

onEnterFrame = function(){
ease(_root.mainSite.layout.layoutGroup, -454.4, 208.1);
navEase(navAbout, 0);
navEase(navProjects, 18);
navEase(navContact, 100);
}
}

navProducts.navWinchester.onRelease = function(){

if(_global.isImgLoaded == 1){
_root.mainSite.mainNav.productShots.gotoAndPlay("o ut");
}

onEnterFrame = function(){
ease(_root.mainSite.layout.layoutGroup, -454.4, -1377);
}
}

navProducts.navLewishamcolt.onRelease = function(){

if(_global.isImgLoaded == 1){
_root.mainSite.mainNav.productShots.gotoAndPlay("o ut");
}

onEnterFrame = function(){
ease(_root.mainSite.layout.layoutGroup, -454.4, -848.8);
}
}

navProducts.navSuttonpark.onRelease = function(){

_root.mainSite.mainNav.productShots.gotoAndPlay("s utton");

onEnterFrame = function(){
ease(_root.mainSite.layout.layoutGroup, -454.4, -319.9);
}
}

navProducts.navFormunion2.onRelease = function(){

_root.mainSite.mainNav.productShots.gotoAndPlay("f u");

onEnterFrame = function(){
ease(_root.mainSite.layout.layoutGroup, -454.4, 208.1);
}
}

//Main Nav Contact Section


navContact.onRelease = function(){

if(_global.isImgLoaded == 1){
_root.mainSite.mainNav.productShots.gotoAndPlay("o ut");
}

navProducts._x = -1000;
navProducts._y = -1000;
navInfo._x = -1000;
navInfo._y = -1000;

onEnterFrame = function(){
ease(_root.mainSite.layout.layoutGroup, -909, 208.1);
navEase(navAbout, 0);
navEase(navProjects, 17.9);
navEase(navContact, 35.9);
}
}

Setting And Passing Variables In AS3
I need to set and pass a variable to an embedded .swf. I know setting a variable looks like this:

var iknow:int;
iknow = 20;

This just sets the variable on my main .swf. How do I send it down so the child .swf recognizes it too?

Thanks in advance for any suggestions.

Setting And Checking Variables
Hello, I am trying to create a game where when the "x" key is pressed it sets the value of a variable (acid) to 1. Meanwhile, a MC is checking to see if acid = 1 and if it does, it tells another MC to gotoAndPlay a certain frame. Here are my codes:

Frame 1 (Declaring the variable):
var acid = 0


Frame 1 (MC that checks Acid=1):
onClipEvent (enterFrame) {
if (acid == 1) {
_root.player_mc.gotoAndPlay("acidgun");
}
}

Code that sets Acid to 1:
if (Key.getCode() == 88) {
acid=1;
}

I need help fast! Please HELP! plz!?
Thank you in advance...
DV90





























Edited: 11/22/2007 at 08:07:20 PM by DV90

Setting And Then Checking Against Variables?
Hey there. I've been trying to figure out how I could somehow create an "if then" statement with variables for my website.

Basically I just want to have a button that checks for a certain variable when you click it (I want it to check if a movie, lets call it "movie1" is already loaded). If it comes back false, then movie1 and movie2 both get loaded.

This way, after movie1 is loaded for the first time, it wont be loaded again. Basically, movie1 is just my background for all my other movies. So clicking button1 for the first time would load movie1 and movie2. Clicking button2 AFTER button1 was clicked would only load movie3.


Got it? Problem is, I'm limited in my knowledge of actionscript and variables, so I need some help (actually, lots of help, as I dont even know where to begin) to get this working. Thanks!

Setting Global Variables?
I'm fairly new to Flash Action Scripting but not to programming.

I was wondering how to set variables that are used globally? I would like to have a list of variables in the first frame of my movie that I could use throughout the movie in different scenes/buttons/movies etc. How exactly do I do this? Is it even possible? What is teh syntax?

Thanks!

Variables And Setting, Quite Simple
Hi there,

I have a function that loads different parts of a external text file, and it works fine. But now i need to change the name of the textbox to get a scroll bar to work.

I just cant get this "path" argument to work. The variable is getting passed through and when i Trace the variable reads fine and also works with the textImport.jgm = this[path]; part! Just NOT when i set scrollableText to path!

This works fine ( variable being set manually )

I have a keyframe which is triggered by a button which has:


Code:
loadText("webDesign");



Code:
function loadText(path){
textImport = new LoadVars();
textImport.onLoad = onText;
textImport.load("content.txt");
function onText() {
scrollableText = webDesign;
textImport.jgm = this[path];
scrollableText.border=true;
scrollableText.htmlText = textImport.jgm;
scrollableText.borderColor=0x000000;
}
}
But this DOESNT work!


Code:
function loadText(path){
textImport = new LoadVars();
textImport.onLoad = onText;
textImport.load("content.txt");
function onText() {
scrollableText = path;
textImport.jgm = this[path];
scrollableText.border=true;
scrollableText.htmlText = textImport.jgm;
scrollableText.borderColor=0x000000;
}
}
Please help and thanks for your time.

Setting Variables With A Button AS3
Hi,
I'm prety handy with AS2 but AS3 has come and pulled the carpet from under my feet. I need to know how to do the following. In AS2 you would set this script on the button:
CODEon (release){
    variable = "variable amount";
    gotoAndStop("labeled frame");
}

Setting Variables Within A Looping Mc
I have a movie clip which is constantly looping from the first key frame to the second, I want to set variables in this key frame from the timeline. Because the movie is looping, the variables are constantly being reset (the first key frame has: variables = ""). Is there a way I can create a new variable within a movie clip from the main time line? (doing this, I won't have to put in variables = "" and thus no reset will occur). Or is there a different way of doing this?

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