ActionScript 3.0 :: Appending Numbers To Variable Name?
Oct 2, 2009for(i=0; i<16; i++){
var ball+i: ball_mc = new ball_mc();
addChild(ball+i);
[code]......
for(i=0; i<16; i++){
var ball+i: ball_mc = new ball_mc();
addChild(ball+i);
[code]......
I am trying to get all the button instances to become invisible on the screen. They are named img1 to img30. I thought of using a while loop to quickly run through them. The code within img1 button is:
var i:Number = 2;
while(i<=30) {
img2._alpha = 0;
i++;
}
The problem is how do I append the i after img, to replace the 2? so that the code runs through img 2 to img 30. I know the answer might be simple
how to do this and not found much, so here goes:
I want to generate a variable number of random numbers less than 16 with no duplicate numbers
Ive posted the fla, and what i'm doing is generating a random number and putting it into an array then using a for loop to cycle through the array for each new random number to check if its already there. if it is, then i want to regenerate that number.
if you test the fla you'll see that all i get in my array is some lovely zero's and i sort of know why this is, but don't know how to stop it.
Basically, I have an input box on a widget that sends information via PHP.
One of the input boxes is phone number. Everyone inputs number as normal, but without the country code.
Is there a way of me taking their normal number from the input box, removing the '0' and adding the country code before sending it (i.e. within a calculation/function/formula).
I am having problems with this if else statement. I have a variable (frame number 30) passing into my swf from another swf. This I know is working correctly.
But - I need to be able to direct to different frame numbers depending on the variable, this is working.
But when I place this code:
[Code]...
Im using a tween engine, and its syntax for use is as follows::
[Code].....
How can I write "_x",100,1,"easeout",0,callback as a string?? I have tried to put "these" around the text. The problem seems to be that "_x" and "easeout" which are effectively strings inside the string! -- but for the tween engine to work - I need to declare that.
Not able to load the swf mySlide is a variable which stores the slide numbers
loadMovie(mySlide+".swf",1);
I am trying to write a short AS3 script in CS4 that allows me to step backwards and forwards through an animation. I have a stop button a play button, rewind button and a forward button. The buttons work ok apart from when I hit the rewind button sometimes it jumps to the start of the timeline rather than just step back a frame at a time. When I use the stop button and the timeline stops where it is, the rewind button steps back as required.
But, if the rewind button is clicked first it jumps to the start of the timeline, I know the theory as to why I cant get this to work. I need to know how to increment an integer variable (counter) to increment as the animation players. i.e. the counter variable to match the frame number. Below is the code I have, how to match an integer variable to the current frame and tell me where to insert the line of code on the listing.
var counter = 1;
gotoAndStop(counter);
function setupevents(){
buttonplay.addEventListener(MouseEvent.CLICK, playbutton);
buttonstop.addEventListener(MouseEvent.CLICK, stopbutton);
[Code] .....
how to do this and not found much, so here goes:
I want to generate a variable number of random numbers less than 16 with no duplicate numbers
Ive posted the fla, and what i'm doing is generating a random number and putting it into an array then using a for loop to cycle through the array for each new random number to check if its already there. if it is, then i want to regenerate that number.
if you test the fla you'll see that all i get in my array is some lovely zero's and i sort of know why this is, but don't know how to stop it.
I am having problems with this if else statement. I have a variable (frame number 30) passing into my swf from another swf. This I know is working correctly.
[Code]...
(in case it was a string vs number issue.) it just stops - it does not go to frame 30. I need this because I need the file to stay on frame 1 if no variable is passed in. Am I doing something obvious wrong? Is there a better way to do this?
I have the input textfield with instance name vIn, and the variable _vIn. (The textfield is empty.)[code]i have five other variable/textfield pairs were this works ok. I don't get why this pair doesn't work also, my textfields won't accept the subtraction operator, - , even though they're all set to vIn.restrict = "0123456789.-";It doesn't even work in the output textfields were there's no restriction (Negative results are displayed positive)
View 3 RepliesI want to create a game that has a HUD, showing the player's energy, money and the number of days that has passed. In the hud, I have created an editable text, which I assume would be the same as a dynamic text (I recently transitioned to as3). The editable text also has an instance name. As I create number variables, how would I go about having the variable numbers show up inside the editable text?
View 3 RepliesHeres My XML ...
Code:
<videos>
<video_path>flvs/50.Cent.In.Da.Club.flv</video_path>
<artist_name>50 Cent feat Slim Shady</artist_name>
[Code].....
Here is my actionscript use in appening ( Source From Kirpua Forums )
Code:
AddNewsEntry = function(news_xml, title, body){
var entryNode = news_xml.createElement("entry");
entryNode.delete myXML.photo[1]; = new Date().toString();
[code]...
I am appending HTML text of a textfield to an XML object. The HTML text appends fine when I append it to an XML object directly. But if I append this XML object to another XML object or to a sub node of an XML object, I am getting the "<" ">" tags getting replaced by:
View 5 Repliesis it possible to append some data (like a string or an array or an XML portion) to a UILoader so that when I make a listener I can retrieve those data in the called function?
View 0 RepliesJust trying to get the text from my InputText TextArea component to append to my Dynamic text field DisplayText when I press enter. I'm getting weird skewed results.
[Code]....
how to append images to a textfield in actionscript.This is how i want it to be: text, image, text, image. I want the image to be on the same line with the text
View 3 RepliesI have a problem switching the content of a div using jQuery functions clone and append.
In a few words, I'm using two links to show and hide flash videos: link1 shows video1 and hides video2. Link2 shows video2 and hides video1.
Here's the code I have:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
[Code].....
But that doesn't work on IE: the hidden video keeps playing.
I have a dynamic textfiled on stage and I am appending some lines of text each time in a new line with "
", so it like expand downwards.(it just currently serves me as a trace output online so I can check something)
what I would like to do is when that textfield reaches certain height that the first line at the top of the textfield gets deleted as a new one appers on the bottom and so on...
I have Flash CS5 at work, and CS3 at home. I am creating a FLA file at home that I'd like to append to an existing file at work. I'm guessing that I'll just need to import all of the symbols from the CS3 file into the CS5 file and then copy and paste the frames - or is there a better way to do it? What I'd really like to do is to somehow convert the CS3 file into a movie clip symbol that I could just run in the CS5 file. Is this possible?
View 3 Repliesimport fl.controls.*;
var MyText:TextArea = info_txt;
var score:XML = new XML(<score/>);
score.PlayerName = "Maged";
trace(score);
Here I create a new XML date , I want to write these data to an external text file to use it by PHP but I don't have much information about it .
Note i want to append to the text field n't write .
I've got a Flex application that uses link buttons. As soon as I incorporated the link buttons (I assume) the Flex framework started putting history tracking elements below the app in the DOM. For example IE6-8 get an iframe element with id of ie_historyFrame, chrome/safari get a safari_rememberDiv and FF gets a firefox_anchorDiv.
Now, there would be no problem if these elements were hidden by the framework, but they're not. The sit underneath the Flex app (visually and in the DOM) and have a bunch of serialized history data.
I was wondering, is there a way to hide them through configuration or code? I know I could hide them via CSS but it just seems nasty that I'd have to use CSS for something that Flex is supposed to manage. I want the application to be site independent.
Does anyone have any links about using appendChild() and insertchildbefore() because I can't seem to get this to work.
View 1 RepliesI have a flash form on a website that I'd like users to put their info in, and upon pressing the submit button, it'd insert the contents of the text fields into the url.
[Code]...
Where "1s" is the variable....but for some reason, flash keeps saying it wont work.Ive got flash 2k4 pro, so I dont see what the problem is, i used to do this.
I want to add some custom string into the FMS log file. If I am playing a video and I want to append some string every time when that video is played, which is in some way useful to me in analyzing FMS log, then is there anything provided or some function in which we can just pass the string as an input argument that appends it at appropriate place in the log file.
View 3 RepliesI have a virtual on screen keyboard for a touch screen interface. I get the name of the key (Q, W, E, etc) by calling event.currentTarget.name Now each button is a movie clip with a small animation and I need to know which key is pressed so it can call the relevent movieclip..Below is the code:
[Code]....
I am trying to convert a string having numbers to an integer.
//15 9's are there
var str:String="999999999999999"
var res:Number = new Number(str);
But it is not able to convert correctly as the the var res now has the value 100000000000000000. I know that the number has 52 bits of memory, then why is it not able to do the conversion?
Generate four random numbers with the total of the four numbers equal to100?[code]...
View 8 Repliescreate a function that picks out X amount of numbers from a set of numbers? So if X=3, then i need this function to pick out 3 different numbers from say a set of numbers (1, 2, 3, 4, 5, 6, 7, 8) and then stored it into X number of variables.
In saying that, X will only =2, and =5. So in the first instance, i'll need 2 random numbers from the set above that are not the same numbers, and second instance 5 random numbers from the set above (also no repeats of numbers). Then i need to be able to store those 2 or 5 different random numbers from the set into variables to call them with other functions.