Crating A Url According To A Varible Help Please
hi what i am wanting to do is make a url acording to the varible "i"
this is what i thought would work but flash doesnt like it
PHP Code:
var i = 1; var url = i".jpg"
thanks for any help
ActionScript.org Forums > ActionScript Forums Group > ActionScript 1.0 (and below)
Posted on: 02-24-2006, 05:24 PM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
How Do You Use A Varible In The Path Of Another Varible In A Condition Statement?
This is part of a load checking script i'm doing
for (i=0; i<split1.length; i++) {
temp = split1[i].split(":");
if (_parent.(temp1).percent == 100) {
trace(temp[1]);
}
}
In this line
if (_parent.(temp1).percent == 100) {
The bit in brackets temp1 needs to be a varible whilst the rest of the path and the varible name needs to be static.
Anyone know how to format the condition like that ?
Varible Help..
Is there a better way to clear a text field, other than using :
Set Variable: "/:textfield" = " "
I Wonder... About The Varible
i brought a book teaching flash actionscript .
one example is as following:
onClipEvent (mouseMove) {
x0 = _root._xmouse;
x1 = this._x;
y0 = _root._ymouse;
y1 = this._y;
x2 = x1-x0;
y2 = y1-y0;
distance = Math.sqrt((x2)*(x2)+(y4)*(y4));
setProperty (this, _alpha, distance/.5);
updateAfterEvent();
}
i am confused that why they can use "y4".
also the footnote of the page tells reader that the "x2" in line 8 can be changed to "x4",as well as "y4" in line 8 can be changed to "y2", in order to show the different effect on the movie.
actually the movie works when i open it.
i think my origin of the problem is whether:
flash can recognize the varible as x1 x2 x4 .....?
i wonder...
Varible Mc Name
hallo!
ive got an variable which contains the name of an mc i want to switch x, y corrdinates for
how would i do that?
ActionScript Code:
myMcName="ss1";
myMcName._x=200;
how would i do that in a way that worked
Thanks
//VoS
Set Varible, Tell Target
Hi, everyone.
Sorry, I know this must be a very simple question, but I can't figure out what I am doing wrong. I'm still fairly new to Flash 5 actionscript, and have been experimenting lately with a "Rock-Paper-Scissors" type game.
I have two instances of a movie clip on my time line, one name "char" the other called "comp". The first frame declares the varibles "choice" and "compchoice" as follows:
var choice=1;
var compchoice=random (3);
The next frame stops. I have 4 buttons in this frame, 3 to alter the "choice" varible and one to continue to the next frame. Button script is as follows:
on (release) {
choice = 1;
}
With the other two being 2 and 3. Then another button continues the time line and the next frame has this script:
if (choice=1) {
tellTarget ("/char") {
gotoAndPlay ("rock");
}
}
if (choice=2) {
tellTarget ("/char") {
gotoAndPlay ("paper");
}
}
if (choice=3) {
tellTarget ("/char") {
gotoAndPlay ("scissors");
}
}
The problem is that the "char" instance always plays the "scissors" animation. I set up dynamic text fields to track the varible (I've heard there's another way to do this in F5, but I can't remember how) and although it starts as 1 and I can change it with those 3 buttons, when I hit the "Go" button to play the animations, I always get scissors, which kind of kills the game.
Any help would be greatly appreciated.
Thanks!
JG
Little Varible Problem
Just cant figure out what is wrong with this...I'm sure it's simple.
MC "expand"(in main timeline) sets a variable on frame one, open="closed"
on frame 20 there is a stop action and open="open"
a button has the following script
on (release) {
trace (_root.expand.open);
tellTarget ("_root.expand") {
gotoAndPlay (2);
if (_root.expand.open=="open") {
loadMovie("workingband.swf", "_parent.bandtarget");
}
}
}
the trace command doesn't read the change to "open" until the movie is replayed. Does it only check one time after the button is hit? Shouldn't it continue to check and see if the variable is "open"? I want the load movie to happen after the MC "expand" has gotten to the last frame and the variable has changed to "open". thanks for any help.
Varible Question
Ive have this in the main stage. >>
function createButtons(){
playerTurn = 2; <<< MAIN PART of my question
// create the invisible buttons!
j=0;
for (i=0; i<6; i++) {
for (k=0; k<6; k++) {
attachMovie("masterpiece","button"+i+k, j);
eval("button"+i+k)._x = 211.3+(i*56);
eval("button"+i+k)._y = 50.1+(k*50);
j++;
}
}
}
stop ();
ok and i have a button with this code
on (press){
_root.playerTurn = _root.playerTurn++;
if (_root.playerTurn == 4){
_root.playerTurn = 2;
}
}
HOW COME PLAYER TURN DOESNT INCREASE???
TellTarget Varible
I have a stop button that tells a movie clip to stop. The name of the movie clip is set by the variable "slide". Below is the action, which works fine if the stop button is in the main timeline.
on (release) {
tellTarget ((slide)) {
stop();
}
}
However if the button is in a different movie clip it does'nt work. Below is what I thought would be the answer but is NOT.
on (release) {
tellTarget (_root.(slide)) {
stop ();
}
}
I also tried it without any expresions, but no luck. Any items anyone?
Varible Issues
i have three text fields (variables). i need to be able to dynamically be able to set the value of of these fields, but more importantly i need to be able to dynamically select which field to set the value of. in other words i need to store the variable name of the text fields value in a variable and then set the value to the dynamically selected variable. hehe this really is starting to sound more confusing than it should be. anyways the problem is when i try to set the value of a variable from within another it seems to convert everything to strings. any help would be usefull. also been having problems concatenating variables with strings to access other variables and functions. help. thnx.
Problem About Varible
I am a beginner of using Flash 5. I want to know how to export a varible from a swf file to another swf file? Thanks!
Tutorial Varible Help - Im New
I was going through this and I dont understand how to do this: (I am very new at flash)
To create hidden information that is passed to the script and eventually the e-mail, all you have to do is set a variable. For example you can set a unique Subject line in each e-mail you send by creating a variable named Subject. Another example would be if you wanted to set a different destination e-mail address for each occurrence of the form. This is important if you want to be able to use the same exact form to be able to send different e-mails in different locations in the main Flash movie. And then give it a value. Here's an example:
Subject = "This is the Subject";
ToEmail = "joeBob@example.com";
These variables must be located on the same level in the same movie clip as the rest of the text fields. Additionally, the button that will eventually call the script and send the information to your server and on to the specified e-mail, must reside at that same level.
Can you help???
Assigning Value Of A Varible
Hi All,
I am trying to assign some variables value which are placed on the main stage
lets say
var1, var2,.........., varN
_level0.varN
On the main movie another movie is loaded which has some movieclips, whoes shape and color values are changed with the users input (by clicking on the buttons) even can uload the movie but if he further loads the movie he should get the same (last view). There are about 100 such movies and movie clip.
I am saving a varible to store that.
but when I want to reset these variables
lets say
_level0.varN = 1
for(i=1; i<=myMCvar.length; i++)
{
var setVAR = eval("_level0.var"+i);
//default value is
//I want to set it to 2
//I tried this way
trace (setVAR);//output is 1;
setVAR = 2;// but this doesn't work ...
trace (setVAR)//output is 2;
trace (_level0.varN);//but the output is 1, where as I want it to be 2
}
Can Any one Help me in This..
Bids
Loading A JPG From A Varible
Hi there,
I want to be able to open a html pop window of a specfic size, loading a jpg in it from a varible from within flash.
I have messed around with it, but can't get anything working. - gettingflash to pass the url for the jpg and getting the html to load it??
Can anyone help
Many thanks in advance.
Kaan.
Random Varible
I have varible
number_of_tracks
that i read for an external file, it reads it in fine.
i then want to create a random number using it but for some reason all i get is 1 coming out
myRandom = random(29)+1;
it works fine if i replace the varible name with an integer
Andrew
EDIT : i myRandom has to be a whole number
Get URL Button To Use Varible As The Www.com
Ive got a text box with the varible "link1" ive then got a external txt file loaded telling "link1" to be ......www.microsoft.com ...for instance.
ive then got a button next to the text box... which i want to add some sort of Get URL action to it so that it takes the varible from the txt file or text box then opens a new window with that link.
The reason for this is because i want to only have to change the txt content to change the links included in my flash movie...
Sounds great ...with hardly no messing around....
Can anyone help me.....
DONT REPLY with JUST get URL command ...a no brainer can do that...i just need it to get the url dynamically........ASWELL
anyone!
Ta
Sendto Varible
so i have this form which is going to be used to sell things, like a shopping cart. i have it all worked out but now i need it to be sent to a email address with all the information and headings...
How is this done???
Sendto Varible Help
sendto varible
so i have this form which is going to be used to sell things, like a shopping cart. i have it all worked out but now i need it to be sent to a email address with all the information and headings...
How is this done???
Loading Varible From Php
is it possible to tell flash to get a varible from a php file which the flash movie is embeded in.
for example i have a mp3 page mp3.php which contacts a mysql database and gets 1 (only 1) mp3 by calling it by id mp3.php?id=2 if i embeded a flash player into mp3.php how would i go about getting the url from mp3.php so that the embeded flash player would play it ???
any comment would be helpful at this point!
How Write This Varible
Heloo, i'm a beginner in flash..
i have some problem with my flash..
i'm sorry if my english is not well..
can u help me:>
i have some movieclip that the name are node1, node2, node3 ... etc.
then, i want to access them with function FOR, just like :
for (i=1; i<10; i++)
{
_root.node[i]._visible=false;
}
my question is how to write in the action script to access my movieclip?
Is that ...node[i].. true or false?
but, it's not working 2 me..
i can't find the answer in actionscript dictionary.
after that how to write it if :
//i have a variable car.
car=2;
//and then i want to set the property of my movieclip
setProperty("assembly/nav", _x, getProperty("assembly/node[car]",_x));
setProperty("assembly/nav", _y, getProperty("assembly/node[car]",_y));
is that ...node[car]... true or false?
how to write in the action script?
thanks for anyone who can help me.
Cant Get Flash Varible Into Php :|
var SenderLoad:LoadVars = new LoadVars();
var ReceiveLoad:LoadVars = new LoadVars();
saved.onRelease = function() {
SenderLoad = changes.text;
trace(SenderLoad);
//It traces what I typed in the textArea...
SenderLoad.sendAndLoad("http://www.fmj.sirx.org/writeit.php", ReceiveLoad, "POST");
};
<?PHP
$flashData = $_POST["SenderLoad"];
$myTextFileHandle = 'testfile.txt';
fopen("testfile.txt","r+");
fwrite($myTextFileHandler, "$flashData");
fclose($myTextFileHandler);
print("&receiveLoad=$flashData");
?>
I seriously cant figure out why it wont write... I have file permissions set for the swf, php, and the text file I'm tryin to write to. If somebody could help me out I'd really appreciate it!
Varible & Text In Same Txt Box.
Sorry for the n00b-ness of this post, But I am still learning proper syntax.
I am just trying to make a text box display a percentage and want the % attached to the end of the variable. What is the proper syntax? Thanks in advance!
Flash Varible
flashvars
Hello im trying to build an mp3 player that reads the playlist from the flashvars code in the html. I've got the player to load the playlist with this code
loadSongList("playlist.xml") ;
My varible name is "var1" . I tried this code but it dosent work.
loadsonglist = var1;
this is my html code
Code:
--------------------------------------------------------------------------------
param=flashvars value="var1=www.mysite.com/playlist.xml" />
--------------------------------------------------------------------------------
how do i set this up?
Edited: 05/10/2007 at 09:44:49 AM by samuels2921
Global Varible
Well, first I have a question. Once a varible is created in any frame and layer on the during the flash movie, can any actionscript frame or layer access that varible? And if not, then how do I create a global varible within flash?
Global Varible
Ok, I created an varible.as file as follows:
package {
public class glo {
public static var ConnectionSpeed:String;
ConnectionSpeed = "Hello World";
}
}
Now, I have a .fla file, and set the "actionscript 3 settings" on the publish settings...underclass path, I added: varible.as Not sure if I needed to that or not.
Now the problem is, I can't access that varible from within the flash movie. I tried just referencing it with: glo.ConnectionSpeed and also with varible.glo.ConnectionSpeed and it does not work. Please Help.
Varible Question?
If i load a movie in _level50 and have a var set like a name (inputName), then later that movie is replaced by a different movie in level50---does that wipe out my varible or is it still there that this new movie could use the varible and display it in a dynamic text box?
Thanks,
-M
Sending A Varible To A URL
I'm wanting to send to a variable to a URL, but can't remember how to do it. In this case it is sending a Zip code entered on a CD-ROM to the company's site so the user will be redirected to a regional site. All I need is how to send the variable from flash.
Please help!
Werd,
_ag
I Want To Check A Varible Condition
I'm trying to check a condition between -100 and 100 using the if syntax, how can I do this, im trying to use > and <
Code
/:mousex = getProperty ( "../popup", _xmouse );
/:mousey = getProperty ( "../popup", _ymouse );
if (/:mousey<-100 and /:mousex <-100>100) {
/:mouse = 1;
} else {
/:mouse = 0;
}
Calcuting Varible Values?
i am making a questionaire having 4/5 questions,i want the user to tick the yes or no options,the moment they press 'see result' buton, i want to display a particular scene of ananother MC(by tell target),I have put an Mc having 2 keyframes having two buttons in both the frames on whose click i set a variable t=1 or t=0;depending on the yes or no click.I put different instances of this mc before every question.How can i calculate the total no of 't'(the variable) to show the desired response.i.e if their are 2 right answers,3 right answers etc.
Otherwise also how can we pass the value of a variable from one mc to another or to the mc in which it is residing?
Varible From .txt File To Instance
Ok- (this is tough to explain)
I have a .txt file that hold varibles. Now, in Flash 4 for mac, I am tring to show this variable inside a text field. I can get the text field to show the variable when it is in Scene 1. However, I can not get the text field to show the variable when it is enclosed in a movie symbol placed on Scene 1. I am sure the problem is what I call the variable in the text field properties, but I can't figure out the correct syntax.
Here are the test files to make it easier to show what my problem is:
http://kalnin.com/problem/
The file is commented and shows what my problem is exactly better then words!
Any help is greatly appreciated!
A Simple Varible Problem
I have a problem loading a txt file
loadVariablesNum ("http://www25.brinkster.com/liljjw/db/vote.txt", 0);
stop ();
This load the txt
vote.txt looks like this
y=12&n=23&w=34
I have three dynamic txt boxeas with varible y, n, w
When I pres CRTl+ENTER to preview the movie, it load the three values for y,n, w as 12, 23, 34,
When I upload the file to http://www.mbyouth.8k.vom/index.swf
then online, it will not load the varibles y, n, w they instead appear blank?,
please help me
Varible Plus Random Number
hey all
I would like to know how to add a random integer to a varible. i set a varible to what ever number i want, but i need to add it to some random number between 1 and 150. how do i go about doing this??? Also are there any good Flash 5 actionscript books out??
PARAM Varible In Flash
How to get the PARAM varible in flash?
PARAM NAME=bb VALUE=hello
how can get this var in flash?
thanks alot~
Set Varible To Complete Action
Hello,
I've tried everything but it won't work.
I'll try to explain my problem
I'm setting up a container set of variables on the main stage.
set (portgo, "");
set (portno, "");
Once I press a button imbedded in an mc of course It will set the varible.
on (release) {
_root.actions.portgo = "go" + _root.actions.gotoAndPlay(1)
I set the these actions in a mc called actions. (I originally set them on the main stage, but that that didn't work either)
play ();
if (portgo ="go") {
_root.cats.catsright.gotoAndPlay(2);
} else if (portno ="nogo") {
_root.cats.catsright.gotoAndPlay(21);
}
So the ideas is, I leave the varible blank to set it later, I press the button, this defines the varible, and calls on the action mc to check the if or else if statement. Sounds logical, doesn't work. Please Help....Thankyou Jacob
My Actions Again
set (portgo, "");
set (portno, "");
on (release) {
_root.actions.portgo = "go" + _root.actions.gotoAndPlay(1)
play ();
if (portgo ="go") {
_root.cats.catsright.gotoAndPlay(2);
} else if (portno ="nogo") {
_root.cats.catsright.gotoAndPlay(21);
}
Variables Varible Names
Ok i got a problem, i ll explain briefly my job:
i'm doing a page that can be only reached with a login and pass word... the problem is that my client don't know a single thing in flash and want to be abble to create login and pass word for new user without having to contact me each time.
so i planned to have the L/P stored in an external text file so he just have to had some..... the variable for the l/p are stated like this : log1, pass1, log2, pass2, log3 pass3 etc..... i wanted my clip to scan the login name entered in the field and compare it with the login in the text file. So to achive that i would have to but a variable in my variable name somthing like if log(x) = input go to........ else set x =x+1..... this way all the log are compared one after the other. once the log match one of the log in the txt (say input = log12) flash scan to see if pass12 = inputpass......
well it's the idea... the problem is that i can't manage to insert the variable x (the number of the log ) in my varible name so flash scan all the log(x) varibles one after the other without having to prog them all one by one
anyone knowa way to achive that ?????
Buttons In Varible Clips
Im doing on a project that requires "Variable Clips". I had gone through the tutorial, found on Flashkit:
http://www.flashkit.com/tutorials/In...63/index.shtml
But was wondering how can you insert the "Button" within the Variables Movie Clip and make it animate.... say the "Button" slide across with the number "1" Movie Clip? Is this possible?
Cheers
Dynamic Text + Varible Help
First of all thanks to all the people that have put in tutorials and help with Flash. I have a very productive addiction now and blame you all for it.
Im using Flash 5.0
Main Question:
If this is answered i can figure out someway around my other problem.
Is it possible to include a variable value in the output of a dynamic text. (ie. Color= Blue , Output text "Your (color) shirt").
Problem:
Root>Movie1>Movie2
I want a varible within Movie2 to manipulate a dynamic text box within
Movie1 without putting the dynamic text box in the root. Its very easy to target a movie clip to any other movie clip but i can't seem to figure out how to use the varibles inside each the way i intend
Varible Targeting Problem
Using Flash5
i have a loan calculator in my project thats its own movie clip, when a button is pressed it (is supposed to) adds 5% intrest. If i use
the standard formula in a button within the root it works great
loan=100
loan = loan*.05+loan(button)
loan=105
but when i try to target the varibles in the movie it becomes:
_root.loancalc.loan=100
_root.loancalc.loan*.05+_root.loancalc.loan(button )
loan=5100
this is with either the expression for the new value on/off
Suggestions? Thanks much
Help W/ Varible In A Dot-syntax String.
I'm attaching MC's to different instances of MC's
This code works, but I want to make the MC name, right after the "_root." dynamic so I can put it in a loop.
_root.A1.ChoiceBG.attachMovie(/:ChoiceA1, "Daughter", "10");
_root.A2.ChoiceBG.attachMovie(/:Choiceb1, "Daughter", "10");
_root.B1.ChoiceBG.attachMovie(/:Choicec1, "Daughter", "10");
This does NOT work:
cell = al
_root.[cell].ChoiceBG.attachMovie(/:ChoiceA1, "Daughter", "10");
How can I change the path w/ a variable?
Thanks.
GrRRRrRrr Varible Problem
Greetings,
I am pulling out my hair and I don't get why in the blue blazes this is happening.
Here is the coding I am working with (I am making a complex calculator for a game).
for (x; x<_root.tobebuilt.tobebuilt; x++) {
pob = x+_root.pbuilding.pbuilding-_root.pmax.pmax;
Lets assume _root.pbuilding.pbuilding = 20
and _root.pmax.pmax = 5
_root.tobebuilt.tobebuilt=10
and x is a changing as it runs through the "for" statement.
So the first time through the loop it should be 1+20-5=16, then 2+20-5=17 then so on until the for loop ends at ten.
What is happening is that the x value is being read as a text string so 1+20-5=115, 2+20-5=215.
What am I doing wrong?
Loading Varible From Outside Source
hey guys,
am trying to capture a word or varible u might say from an asp file using flash.
how do i do this and is this possible?
also...wondering can i capture something from the URL address box from the browser?...
for example....www.example101.com/chat.asp?idUser=85
can capture the "85"?
thank you guys..
Loading A JPG From A Varible To HTML
Hi there,
I want to be able to open a html pop window of a specfic size, loading a jpg in it from a varible from within flash.
I have messed around with it, but can't get anything working. - getting flash to pass the url for the jpg and getting the html to load it.
Can anyone help
Many thanks in advance.
Kaan.
VARIABLE Varible Names
I seem to be having undue difficulty with this... perhaps it's not possible...
My problem is that I have a number of variables (eg. Xvelocity or Status)which I have set up as object properties(Eg. Avatar.Xvelocity or Enemy.Status); My problem is that I would like to be able to have these objects name themselves according to whatever title I give the MovieClip which contains them.
To clarify: If I have a Library MovieClip called "EnemyHandler" whose first frame declares something to the effect of "Title = new Object();" followed by a number of "Title.Xvelocity = 5; Title.Rotation = 61", is there a way for me to take the variable "getProperty(this, _name)" and make that the object name?
In the end, if I have two instances of this "EnemyHandler" movieclip, one name "MCDude" and the other named "MCBaddie", how could I get them each to initilze their own set of variables/object names, eg:
MCDude.Xvelocity =5;
MCBaddie.Xvelocity =5;
I'm really stuck on this.
Varible Value Change Problem ?
Hi,
I have i'm sure what would be classed as a very simple problem however I can't figure it out. I'm implenting various language versions of a site, what i wish to do is have various buttons with a range of languages once clicked the text for the buttons changes in the relevent language.
My code:
I declare the global varible of which i want english to be the default:
_global.language = "english";
I have placed this for where the text goes
onClipEvent (load) {
if(language == "english")
{
this.txt = "working english version";
this.txt_inst.autoSize = "left";
}
if(language == "french")
{
this.txt = "working french version";
this.txt_inst.autoSize = "left";
}
}
and finally the button:
on (press) {
language = "french";
}
The button is what i belive i'm having issues with as it's not changing the varible accordingly. When i cahnge the vaule of the global funtion where it's declared it follows through however does'nt when clicked on via the button.
Any help or sugestions regarding this would be most appreciated.
Cheers
Varible Movie Width
I've created a Flash movie which I am inserting into Dreamweaver.
Is it possible to define a flash movie as 100% wide on the screen? Using properties in both Flash and DW just put the movie at 100% of it's size, not the size of the page. I want the movie to expand and contract to fit the users window.
Any ideas?
Thanks!
Attachmovie Initialize Varible.
Hi,
i tried:
Code:
this.attachMovie("SitDown","bSDP1",this.getNextHighestDepth(), {_x:100, _y:200});
SitDown is a button, why the _x, and _y doesn't work?,
|