Setting A Fixed Variable For A Dynamic Button?
Ok, i'm a little lost, so i'm reaching out to others for some help with this.
So i'm making a drag and drop audio mixer. there are some dynamic clips that are dragged into a "track timeline". when the item is dropped on the timeline, i am placing two duplicate clips on the "track timeline". one's width is sized to the length of the song attached to that draggable clip that was dropped, and the other is a text field, printing the number of seconds with a "close" button to remove both duplicate clips from the "track timeline" if it's pressed.
my problem is this:
i have the duplicate movie part within a "for each" loop for the draggable sounds. for each of the close buttons, i am trying to attach code that will close just the button it is placed on. but since the button's path is in a dynamically created movie clip, i've used a variable to tell which clip it will close.
however it always closes the last clip placed cause that's the current value of the variable. is it possible to set a fixed variable value for when the button onPress code is written? i've highlighted the troublesome part is red below.
any help or anyone else's ideas on how i can do this would be greatly appreciated.
if (this.onTarg == track1_mc) { if (_root.track1.length>0) { _root.songNumber1++; track1[_root.songNumber1] = this+".mp3"; trackAudio1.onLoad = function(success:Boolean) { var totalSeconds:Number = this.duration/1000; var seconds = Math.floor(totalSeconds)%60; if (seconds<10) { seconds = "0"+seconds; } trace(seconds+" seconds"); ph = _root.empty_track_mc.duplicateMovieClip("track1Hol der"+songNumber1+"_mc", _root.getNextHighestDepth()); ch = _root.emptyTop_mc.duplicateMovieClip("track1Top_mc "+songNumber1, _root.getNextHighestDepth()); newNum = songNumber1-1; if (newNum == 0) { oldNum = "trackHolder_mc1"; } else { oldNum = "track1Holder"+newNum+"_mc"; } endNum = getProperty(oldNum, _width); nextNum = getProperty(oldNum, _x); _root["track1Top_mc"+songNumber1].clipTest_txt = seconds+" sec."; ph._x = endNum+nextNum; ph._y = _root.track1_mc._y; ph._width = seconds*8; ch._x = endNum+nextNum; ch._y = _root.track1_mc._y; ch.close_mc.onPress = function() { track1.deleteAt(_root.songNumber1); unloadMovie(ph); unloadMovie(ch); } }; trackAudio1.loadSound(track1[_root.songNumber1], false);
KirupaForum > Flash > ActionScript 1.0/2.0
Posted on: 02-16-2007, 12:13 PM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Dynamic Variable - How Do I Make It Fixed?
I am sure I am missing something completely obvious here but here is the problem I have.
I have a red dot (movie clip) that moves randomly around the screen. when the user hits a key, I want it to store the x and y variable of the dot into a location.
So far this is fine, but here is where it goes wrong.
I use the following lines to store the variables and jump to the next frame.
_root.yfinal=_root.rotatedobject._y;
_root.xfinal=_root.rotatedobject._x;
_root.gotoAndStop(2);
And then on the Second Frame I just display using dynamic text fields where the x and y pos of the dot was when they hit the keyboard.
BUT in this second frame, I dont have the red dot movie clip anymore and I think this is where it is going wrong.
I believe that _root.yfinal is storing whatever _root.rotatedobject._y is SO when I go to the next frame and it isnt there, it doesnt display anything since it cant find rotatedobject.
How do I get a 'snapshot' of the x and y position and store it in a variable that can be used anywhere and doesnt keep changing.
If you need me to elaborate or anything let me know and I'll explain further.
Cheers.
Setting Dynamic Variable Names :s
heres the code im working on:
Code:
var temp1 = 1;
var temp2 = "hi";
var temp3 = [temp2+"6"];
temp3 = temp1;
trace([[temp2]+"6"]);
why is hi6 returned?? i need it to return the value 1
temp3 = hi6;
i want the variable to be named that, so effectively hi6 = temp1;
so when i call temp2+6 or hi6 it returns the value of temp1 which is 1;
Setting Variable To A Button
Is there a way to define an action from a button as a variable?
I want to make a button which has the action "gotoAndPlay(1);", then i want to create another button which switches that action to "gotoAndPlay(5);".
If there's a way to do it, can someone please tell me how?
Setting Variable With Button
I'm quite new to Flash and I'm trying to do something which seems that it ought to be quite simple but I cannot get it to work.
I have a sequence of scenes which show images fading in and out. I've got some buttons that can be pressed to go to (in each case) another sequence of scenes. What I want to do is to allow any individual image to fade out before I jump to the alternative set of scenes.
My thoughts were - when the button 'onrelease' occurs set a variable e.g. button equal to a number corresponding to the button which was pressed. So, if I have Button1, Button2 and Button3 and Button2 was pressed I'd set a variable 'buttonstatus' = 2. The small scene which is fading my image out would keep playing and at the end of the scene I'd test the variable. If it equalled 2 (in this example) I could then jump to scene 2 in my movie and carry on from there.
The code for the test I've put in is
if (buttonstatus == 0) gotoAndPlay("Scene1",1);
if (buttonstatus == 1) gotoAndPlay("SceneA",1);
if (buttonstatus == 2) gotoAndPlay("SceneB",1);
All that happens is that Scene1 plays again and again. I'm guessing that the variable isn't being set by the code I've assigned to the buttons, for example,
on (release) {var buttonstatus = 1}
Am I asking the impossible? Or am I just missing something incredibly simple?
I would really appreciate some help.
Thanks
PhiltheBear
Setting Variable From Dynamic Text Field.
ok im getting close now.
i have a dynamic textfield with an instance name of recorde_id
my code goes to a database and brings back a number an displays it in this dynamic text field. this works fine.
im trying to set a variable called finalScore = "the dynamic text field";
how do i do this.
cheers aron.
(NUB) Setting Dynamic .text And Variable Scope
Hello all,
First, using flash9 and ASC3.
Complete newbie to flash programming but couldn't find answers in this or the newbie forum. I am an artist but have some limited programming experience. But always seem to get caught up on simple logic issues.
I am trying to set (and keep track of) a dynamic text field in a movie clip. I am adding the movie clip from the main timeline and trying to set its properties as well.
//Main timeline code
//create key
var addkey = new key();
gameclip.addChild(addkey);
addkey.name = (j+"_"+i);
addkey.x = i*tileSize;
addkey.y = j*tileSize;
addkey.blockletter.text = game[j][i];
//this is the problem line. game[j][i] references an array of text letters. i.e "A"
trace(addkey.blockletter.text);
//Movie clip code
function initblock(letter){
blockletter.text = lettter;
blockletter.x = 10;
blockletter.y = 1;
//blockletter is the name of the dynamic text field
}
initblock("A");
So, the problem line in the main code above does not give an error and the trace confirms I am setting *a property correctly. However, it's obvious I'm not setting the dynamic text field in the addkey because it does not change.
I have also tried setting a global variable in the main timeline to hold the value for letter and reference that when I call the initblock function in the movie clip but I can't seem to create or reference global or root variables. -- I know, pretty pathetic.
Any help or logic insights would be greatly appreciated. I hope this post is appropriate for this and not the newbie forum.
-cheers
Mystified: Setting A Dynamic Field = A Variable
OK, I am totally stumped. I should also mention from the outset that I'm a pretty advanced user here, and have done the following literally a thousand times, hence my utter confusion.
Here's the story:
1- Load data from XML file, parse it, assign root level variables to the data bits. This is fine, running in debugger shows all my variables are there.
2- I have a dynamic text field at the root level, called "instructions"
3- On frame one, in part of my script I simply set _root.instructions = _root.general_help; (one of my variables from the XML)
4- Nothing displays.
If I manually set _root.instructions = "blah blah blah"; it displays no problem.
If I put another dynamic text field on the same frame, on the same layer as instructions and assign it the variable _root.general_help, this works and displays the proper text.
If I throw a button on stage and set it to onRelease-> _root.instructions = _root.general_help; this works as well.
So what the heck is going on? This is as simple as you can get, and compared with the other things going on in this program it's, like, a negative number on the 1-10 difficulty scale.
Totally confused.
Mystified: Setting A Dynamic Field = A Variable
OK, I am totally stumped. I should also mention from the outset that I'm a pretty advanced user here, and have done the following literally a thousand times, hence my utter confusion.
Here's the story:
1- Load data from XML file, parse it, assign root level variables to the data bits. This is fine, running in debugger shows all my variables are there.
2- I have a dynamic text field at the root level, called "instructions"
3- On frame one, in part of my script I simply set _root.instructions = _root.general_help; (one of my variables from the XML)
4- Nothing displays.
If I manually set _root.instructions = "blah blah blah"; it displays no problem.
If I put another dynamic text field on the same frame, on the same layer as instructions and assign it the variable _root.general_help, this works and displays the proper text.
If I throw a button on stage and set it to onRelease-> _root.instructions = _root.general_help; this works as well.
So what the heck is going on? This is as simple as you can get, and compared with the other things going on in this program it's, like, a negative number on the 1-10 difficulty scale.
Totally confused.
Variable Setting Upon Button Pressing
I'm getting my webpage together, but you see:
I'm defining a variable as follows in the first frame of my movie:
a = 0;
Then, I've got 5 buttons and on each button I'm placing the following script:
on (release) {
Variable Setting Upon Button Pressing
I'm getting my webpage together, but you see:
I'm defining a variable as follows in the first frame of my movie:
a = 0;
Then, I've got 5 buttons and on each button I'm placing the following script:
on (release) {
if (a != 1) {
//Changing the value of the variable a depending on the
//button pressed ( could be {1, 2, 3, 4, or 5})
a = 1;
}
}
And then on the final frame of each section I'm evaluating the value as follows:
if (a == 1) {
gotoAndPlay ("section1");
} else if (a == 2) {
gotoAndPlay ("section2");
} else if (a == 3) {
gotoAndPlay ("section3");
} else if (a == 4){
gotoAndPlay ("sectoin4");
} else if (a == 5) {
gotoAndPlay ("section5");
}
So now, the fact is that, when I press a button, it's just not changing the value of the variable "a", how do I get this script to work. Please help.
If anyone's interested in analyzing the .fla file, please feel free to ask for it, I'm not posting it for security reasons (my site). Thanks. And if someone wants to just see the file here it is:
http://www.geocities.com/foamamoeba/site02.swf
Setting Variable Inside A Button
Last edited by Codemonkey : 2006-07-27 at 05:29.
I stumbled onto something weird. I accidently set a variable inside a button and it works. The question is i don't understand exactly how it works. Here's an example of the code (this sets a button inside a movieclip).
ActionScript Code:
var btn:MovieClip = person_mc.hitarea_btn;
btn.person = 'somebody';
btn.onRollOver = function () {
this._parent.gotoAndPlay('rollover');
}
btn.onRollOut = function () {
this._parent.gotoAndPlay('rollout');
}
btn.onRelease = function () {
this._parent._parent.gotoAndPlay('zoom_' + this.person);
}
Technically i should set the btn variable to :Button, but then it will not accept the variable (because buttons can't contain them). But i've noticed since i used :MovieClip the variable works and when i did a typeof test on the button it declares it as an object.
Does anybody understand this?
Setting Dynamic Text Field Variable Dynamically
Hiya guys
I know that we can set up a var for a dynamic textfiled by putting it in the box but is there a was to do it by code, every route I have taken has failed,
any help greatly appriciated
ta
Zen
Setting A Variable To Keep Track Of Which Button Is Pressed....
i have 7 buttons in a vertical scrolling nav bar. When the user clicks on one of the 7 buttons... a larger image of this button shows up on stage left. It actually animates in, as the previous image animates out.
What i need to know is.. how do i set a variable to keep track of each of the 7 buttons that could be pressed?
I need to know becasue once a button is pressed i need to know which one is pressed so i can go to its build animation and animate the leave animation of the image that was currently there??
steve
Setting Dynamic Text In A Button
My main timeline has a movie clip called "all_buttons"
All_Buttons
---------------
The "all_buttons" movie clip has 6 instances of the same button. This button a dynamic textbox variable name called "txt"
Each button inside 'All_Buttons'
------------------------------------
Each button is name button_1, button_2, button_3, etc... With the behavior of a button.
Problem
------------
When trying the following in Scene 1, Frame 1, Actions layer.....the text doesn't change.
all_buttons.button_1.txt = "Text goes here";
Setting A Dynamic Radio Button's Label And Data
I'm having a problem trying to set the label and data for a dynamic radio button using an external txt file. Can you take a look at this and tell me what I'm doing wrong?
Code:
loadVarsText1 = new loadVars();
loadVarsText2 = new loadVars();
loadVarsText1.load("pollquestion.txt");
loadVarsText2.load("poll.txt");
//assign a function which fires when the data is loaded:
loadVarsText1.onLoad = function(success) {
if (success) {
//trace("done loading1");
question.text = this.varQuestion;
} else {
trace("not loaded");
}
};
loadVarsText2.onLoad = function(success) {
if (success) {
//trace("done loading2");
varAnswers = this.answers.split("|");
for (var i=0; i<varAnswers.length; i++){
_root.attachMovie("FRadioButtonSymbol", "myList" + i, i, {_x:0, _y:100+i*25});
this["myList"+i].setGroupName("radioGroup");
this["myList"+i].setLabel(varAnswers[i]);
this["myList"+i].setData(i);
//this["myList"+i].setLabel("TEST"+i);
}
this.radioGroup.setChangeHandler("show", _root);
} else {
trace("not loaded");
}
};
function show(obj){
var selected = obj.getSelectedItem().label
trace(selected)
//Your code to use the selected value
}
poll.txt
answers=Cincinnati|St. Louis|Chicago|Houston|Pittsburgh|Milwaukee
pollquestion.txt
varQuestion=What team will win the NL Central?
Thanks.
Problem Setting Dynamic Button URLs - Please Help, I'm Stumped.
Here is my entire scrolling slideshow with ONE PROBLEM.
I load an XML file (attached) with a jpegURL and linkURL per node. Everything loads correctly, but when I click on each image, the URL that opens is always the linkURL for the lastnode in the XML file, NOT its own linkURL.
I think this is because once the loop is thru, the 'theLink' variable is set to 'http://www.facebook.com' so when 'theLink' is called in myBtn.onRelease its pulling its last assigned value. I don't know how to fix this.
Problem area:
Code:
for(i=0;i<tPics;i++){
picPath = pNodes[i].attributes.jpegURL;
theLink = pNodes[i].attributes.linkURL;
myBtn = _root.container.createEmptyMovieClip("myBtn_mc"+i,i+1);
thePic = myBtn.createEmptyMovieClip("thePic_mc",i+1);
imgArr[i] = thePic;//create img array reference for scrolling
myLoader_r.loadClip(picPath,thePic);
//// PROBLEM SEEMS TO BE HERE ////
myBtn.onRelease = function(){
getURL(theLink,"_top");
}
}
Entire ActionScript:
Code:
//set _lockroot
this._lockroot = true;
//init loader
var myLoader_r = new MovieClipLoader();
myListener = new Object();
myListener.onLoadError = function(target_mc, errorCode) {
trace(target_mc + "ERROR CODE = " + errorCode);
};
myListener.onLoadInit = function(target_mc) {
if(target_mc._height > maxH){
factor = (maxH/target_mc._height)*100;
target_mc._xscale = factor;
target_mc._yscale = factor;
}else{
target_mc._y = (maxH/2) - (target_mc._height/2);
}
target_mc._x = tWidth;
tWidth += target_mc._width;
//trace(target_mc);
//trace(tWidth);
};
myLoader_r.addListener(myListener);
//init vars
tWidth = 0;
maxH = 150;
//myURL = "http://www.google.com";
//load xml
slides_xml = new XML();
slides_xml.onLoad = startSlideShow;
slides_xml.load("slides.xml");
slides_xml.ignoreWhite = true;
//go
function startSlideShow(success){
if(success){
rootNode = slides_xml.firstChild;
tPics = rootNode.childNodes.length;
//trace(tPics);
pNodes = rootNode.childNodes;
_root.createEmptyMovieClip("container",1);
lastWidth = 0;
imgArr = new Array;
for(i=0;i<tPics;i++){
picPath = pNodes[i].attributes.jpegURL;
theLink = pNodes[i].attributes.linkURL;
myBtn = _root.container.createEmptyMovieClip("myBtn_mc"+i,i+1);
thePic = myBtn.createEmptyMovieClip("thePic_mc",i+1);
imgArr[i] = thePic;//create img array reference for scrolling
myLoader_r.loadClip(picPath,thePic);
myBtn.onRelease = function(){
getURL(theLink,"_top");
}
}
}
}
this.onEnterFrame = function(){
if(slides_xml.loaded){
for(n=0;n<imgArr.length;n++){
imgArr[n]._x -= 1;
if(imgArr[n]._x <= -(imgArr[n]._width))//pic width
imgArr[n]._x = imgArr[n]._x + tWidth;//total pics * pic width
}
}
}
Please, help. I've attached everything in a zip file. If you need anything else to help out, msg me on here I'll check regularly or AIM me: bensonboy4
Thanks
Fixed Dynamic Text Box?
Hi, how do I set the dynamix text box i've made to be a fixed one? In one of tutorial files I have, the square box bottom right is black instead of the usual white i always see, and i presume that is making the text box locked and when i type in the box won't expand but rather the text will go on without expanding as mentioned, it's like the text got cut off or just like scrolling but wifout scroll bar, get it?
But when i tried with mine, it will expand and all the text typed in will be visible... any clues?
t.i.a
[ed]
Named Anchor Fixed? And Dynamic Anchors
Named anchor is a new feature that was one of the main reasons why I bought MX.
I soon found out that it didn’t work! :(
Example: If you have 3 pages with anchor names 1 to 3, you will encounter a problem. If you start out at 1 (in the Flash player) and jump to 3, and click the browsers back button, you get page 2!
Does any one know if Macromedia is working with this problem?
If yes, does anyone now how to set anchor points dynamically?
Text With Fixed Width But Dynamic Height
i need to have on my page a text which has to get
a fixed width ... but a dynamic height ( this text must be dynamic) !!
please tell me how can i do this !! ?
ThX.
Resize Dynamic Text To Fixed Size
Hi
I have a problem...
I want to create a sort of image out of some input text.
The problem is:
In frame 1,
you can input a line of text of max 20 characters for example you can write 5 characters or you can write 15 characters.
Then you press a submitbutton (or something)
and in frame 2
You should see a fixed size "image" of your text, the imagesize allways is 400 by 50 pixels, and the text shall fill exactly that area. Meaning that no matter if the text is 5 character or 15 character long, the size of the word(s) should be 400 by 50 pixels.
How can I convert that Dynamic text to a kind of image that i can set the exact size to.
Set Variable: Setting Variable Name Dynamically
hi...
i want to set a variable dynamically, i have done:
soundCount = 5
set (eval("loading"+SoundCount), 1);
i want the outcome as:
loading5 = 1
which i wanna check later...
is it right? because i m not getting the result when i
trace (loading5)
please help
Setting The Value Of A Variable, Checking The Value Of A Variable
i think this might be a simple question, but I can't figure it out and it's puzzled me for a long time. If I set a variable OnRelease - let's say I have 4 buttons that set a variable to 4 distinct values, depending upon which button is pressed. How do I create a check, later, from another part of the movie, for what the current value of that variable is?
Is the variable universal - that is once it is set, the entire movie sort of 'knows' what the value of that variable is? Or do I have to direct the attention of the movie back to the same clip or frame or wherever I set it. Either way, what is the syntax?
I hope I was able to explain this and that it makes sense to someone.
Thank you!
-ml
Setting A Variable Thats Contained In A Variable
This might sound confusing but I am trying to reduce my lines of code by making it more effecient. I want to save the name of a variable into a variable so for example...
_root.number = 50;
_root.saveVariable = _root.number;
Now how do I change _root.number by only using _root.saveVariable?
I am thinking it has something to do with brackets or parenthesis. Any help is appreciated this has really been bugging me.
_alpha Fixed Button Position...
SOS! i've recently created a movie n place a few btns in it and i animated it to move to a new location say x+50 of the original pos.
den i set the button's alpha to be 50 when it is click.
den i create a btn outside the movie clip to activate the movie clip when clicked.
when i click the btns in the movie clip, it did change color. after clicking the btns in the movie clip, i click the btn to activate the animation, however, all the btns dat had their alpha changed, remained fixed to the spot without moving to x+50!
if i comment out setting the alpha, the btns move with the movie clip as planned.
can someone please help! Thanks!
Fixed State Selected Button?
Is there a simple way to create a button that when clicked maintains the 'clicked' state (different colour, shape) untill you enter the website afresh, so that you can see which buttons you have already clicked during 1 'browsing session' on the website? Thanks!
How To Open A New Fixed Window Thorough Flash Button
I would like to open a new window in my browser (in fixed size, without browsers toolbars - just in a simple frame only) if I press a button on my page. Is it the buttons feature or the new pages feature? Where should I setup this and how??
I am able to do it in Dreamweaver- I must setup the new windows behavior to the button thorough I want the new window open (for ex: 'toolbar=no,location=no,directories=no,status=no,m enubar=no,scrollbars=no,resizable=no,copyhistory=n o,width=550,height=400'), but I am not able to do it in the Flash programm for the button - it doesnt work.
Thanx Ondra
Launch Fixed Size Window From Flash Button
Hi All
Can anybody help me please!
I'm trying to launch a fixed size window from my flash button.
I need it to work accross IE, Mozilla, Safari on PC and Mac.
Thanks in advance
E.
Click A Button To Open A Fixed Size Browser
I want to make a button to open a new new URL in a new browser without the top navigation buttons like "Back", "Stop", "Refresh" buttons found in a browser.
what is the scripting like?
thanks.
Please Help Setting Variable
Hi everyone,
I have a input text box called "1" as its value, and a dynamic text box which is called "2" as it's value.
The user input's their name in textbox "1" and then when they press the submit button I would like the dynamic text box "2" to say:
Hello, (name user entered in) how are you doing today?
So, I have been playing with codes but they don't seem to be working. Does anyone have any ideas?
Here is what I came up with, but its obviously not working and isnt right!
For the submit button's actions:
on (press) {
set ( 2, Hello, var="1" how are you doing today? );
}
What am I doing wrong! how do you do this?
Any help would be great!
thanks!
- leland
Setting Variable ... Bah
i have an image viewer i got from this site. and I have been trying as hard as I can to make a button open up an image depending on which thumbnail you clicked. In other words if I click on thumb1.jpg I want the button to open thumb1.jpg, and if I click on thum2.jpg same thing button should now open thum2.jpg. Make sense? I've tried what I know how to do and just can't get this variable to pass ... here is the code ... sorry it's a lot. I th ink what i need to do is get a varialb to set to iNumber onclick of that thumbnail ... then get the button to grab 'thumb'+iNumber+'.jpg' but it doesn't seem to work. toward the bottom of the code is a comment
//
// Image selection functions
//
this is where I THINK i need to do this ... please help.
code:
http://FuzzyDzygn.com/testing/code.html
Setting MCs _x Variable
G'day FlashKit! Ive got 3 MC's (button1, button2, button3, - all MCs) and one "slider"(MC) that appears from off the stage and slides over until its above the button(MC) the users mouse is over. now I wrote this code, but I need the buttons _x value to be the target _x for the slider on a mouseover for each button. I'm not quite sure how to execute this, or it could just be lack of sleep and/or complete and total brain failure. Any help would be greatly appreciated...
Now this isnt much, and I know its a mess, but heres what code Ive got so far:
================================
maintimeline frame1
================================
//am trying to get the slider to slide across the stage when user rolls over button//
//another problem...??? I need it to start off the stage//
slider.onEnterFrame = function() {
if (slider._x < target) {
speed = target - slider._x;
speed = speed / 4;
slider._x += speed;
}
}
//am trying to establish each buttons _x as the target when theres a mouse over the button//
button1.onRollOver = function() {
button1._x = target;
}
}
button2.onRollOver = function() {
button2._x = target;
}
}
button3.onRollOver = function() {
button3._x = target;
}
}
================================
Thanks
Geoff
Setting The Variable
The first frame of my swf file contains the code which gets the properties file from the remote webserver and loads the variables in the LoadVars object when ever the flash file is accessed. Currently i am able to download either english or japanese properties file based on the hardcoded setting in the fla file. My question is like is it possible to load the required properties file based on the client locale settings.
Setting Variable
Hi all,
I want to set the value of a variable called 'scenario' based on the value of another ('angle').
The variable 'angle' is set by the user clicking a button, this in turn rotates a movieclip which acts as a menu for six scenarios which I will load via the loadmovie command.
What I would like/need to do is to set the value of the variable 'scenario' to either scenario1.swf, scenario2.swf ...scenario6.swf depending on the value of the variable 'angle' which could be 3420, 3480, 3540....3720 and then using another button load the relative movie.
Any ideas?
Variable Setting
In flash mx pro 2004, how do I change variables?
Ive got a textbox with the variable name 'talk', and in the frame actions ive put
Quote:
text = 10;
and it doesnt change the text.
and yes, they are on the same timeline.
This is what id do on Flash 5, but on mx it doesnt work, please help!
Setting The Fps As A Variable
I am using Flash MX, and I want to store the frame rate as a variable so the player can set it to what they want in the game. is this possible? if so what is the command?
[CS3] Variable Not Setting?
Hi,
I was troubleshooting a problem I was having and have traces set up so I can follow along. I think I've found it, but I have no idea what could be causing it. What follows is the exact code in question, and the output the traces are giving me.
PHP Code:
wrapUp = function(){
trace("chScores[0]: "+_global.chScores[0]);
trace("answers_cor: "+answers_cor);
_global.chScores[0] = answers_cor;
trace("chScores[0]: "+_global.chScores[0]);
PHP Code:
chScores[0]: undefined
answers_cor: 1
chScores[0]: undefined
How is that possible? The answers_cor variable is the value it's supposed to be, but I can't get the array to keep a value?
[CS3] Help With Setting A Variable
Hi, I have a loader which calls two files: main.swf and interface.swf.
The loader loads main.swf on level0 with loadMovieNum() and interface on level 99.
In my interface file, I have some buttons and a drop down combobox.
When selecting a selection through the combobox, its supposed to load a variable's value from main.swf and display it in a textbox(instance name of 'howmuchall'), but the thing is I can't get flash to recognise the combobox's value as a variable name and not as text.
When I put in this code where combobox.value is the variable name:
Code:
howmuchall.text = combobox.value;
Instead of displaying the variable's current value in the textbox, it displays the variable name in the textbox!
However, if I put in this code:
Code:
howmuchall.text = _level0.costprice;
the textbox howmuchall will display the value of _level0.costprice properly.
I think the solution is simple but I just can't get the howmuchall textbox to display the actual value of the variable(_level0.costprice which is supposed to be a number) instead of displaying '_level0.costprice' as text inside the textbox when using the dropdown combobox.
Can anyone help me with this?
Setting A Variable
On my scene there is 2 movie clip. 1(building_mc) with several button and 2(chance_mc) with dynamic text and static text.
I want to set the variable "4" to the dynamic txt. When we click on a button on the building_mc the variable go down (from 4 to 3 to 2 to 1 and 0 finally). But only when you click on the button; not like a countdown...
also there is some if action related to the chance_mc (at 4 the _alpha=0, 3 the _alpha=100 at 1 chance_mc go to frame 2 and at 0 the _root go to
frame 80)...
So on my action frame on the chance_mc, I put that but it's wrong because the dynamic_txt write 0:
chance = 4;
if (chance = 3) {this._alpha=100;
};
if (chance <= 2 ) {this._alpha=100;
};
if (chance = 1 ) {this._gotoandStop(2);
};
if (chance = 0 ) {_root._gotoAndPlay(80);
};
stop();
Please help me
xelaxam
Help Setting Variable
Hi,
I could use some help setting a variable to control multiple movie clips. I believe it should be fairly simply for someone with more experience than myself.
Attached is a very small sample .fla that explains in more detail what I'm trying to accomplish.
All help much appreciated.
Thanks a million
Variable Not Setting Value
Hello! I'm stumped. In a simple test,
PHP Code:
tester = new Object();
tester.run = function(){
this.theNum = 25;
}
the variable in the object changes when the function is called.
In a more complex example, the same method fails:
PHP Code:
headerObj = new Object();
headerObj.typeHeader = function(theText){
trace("typeHeader function called.");
this.theHeader = theText;
this.id = 1;
this.run = setInterval(this.setIndex,500);
}
headerObj.setIndex = function(){
trace("setIndex received a call.");
trace(this.id);
if(this.id == undefined){
trace("Initializing id...");
this.id = 1;
trace("id="+this.id);
}
this.id++;
trace("Tried to increment this.id. Value is now: " + this.id);
this.refreshField();
}
headerObj.refreshField = function(){
trace("refreshing field...");
this.subString = this.theHeader.substr(0,this.id);
header_txt.text = this.subString;
this.doCheck();
}
headerObj.doCheck = function(){
if(this.id == this.theHeader.length){
this.id = undefined;
clearInterval(this.run);
}
}
In the headerObj.setIndex() function, this.id==undefined is evaluating as true when it is really equal to 1.
Anybody have any idea why?...
Thanks!
Setting Variable
Hi I would like to know how to set variable in flash 2004. I created an interface and the system is suppose to tell it to run.
Setting Variable
Hi I would like to know how to set variable in flash 2004. I created an interface and the system is suppose to tell it to run.
Setting Pictures With Variable
I am useing duplicate movie clip each one with a diferent numeric value though a variable "N" dup"1" dup"2" dup"3" and so on. Can I change the pic in the movie clip useing the value of "N" so all the same movie clips have a different picture. because several diferent movies while not work for this
Setting A Variable On Unload
Hello All,
I was wondering if somebody could tell me if there is a way to set a variable on UnLoad (If there is such a thing)
The thing is that I have already built a huge interface, and the main structure is the following:
I have many .swf's that are loaded into an empty MovieClip (Target) in the Main movie. The external .swf's are always loaded into the same Target MovieClip, thus replace whatever is there before (Right?)
I am trying to detect if there is a certain movie is loaded so I can use an If statement to do different things depending on if that particular movie is loaded. When the loads, it sets the variable /:Portfolio = 1. I want to be able to set /:Portfolio = 0 when it is replaced by another external .swf. Is that possible?
If that is not possible there is another way I have been trying to tackle this problem. Every time a new external .swf is loaded into the empty target movie, there is a variable set /:URL = "The relative URL of the Movie Being loaded" So in this case /:URL = "Portfolio/portfolio.swf"
The easy way would be to say:
if (/:URL = "Portfolio/portfolio.swf") {
"execution in here"
}
But this method does not work for me. I am guessing that Flash can't compare a string like that? Do I have to parse the string or something? Am I correct that Flash is only looking at the String data type but not the actual string?
I hope you can help me out.
-Krummi
Setting The Level As A Variable
Hi am using the following script as a preloader in its own layer:
onClipEvent (load) {
this._width = 0
wid = 10
speed = 6
n = 1
}
onClipEvent (enterFrame) {
wid = (100/["_level" add n].getBytesTotal())*["_level" add n].getBytesLoaded();
_width += (this.wid-_width)/speed;
this._x = 349
}
I am loading various components into different levels and want to use the preloader to target the level which the movie is loaded into, therefore I want to set a variable, which I have done above as n, yet its not working. Anyw genius out there who can help me
Pete
|