ActionScript 1/2 :: Get The "i" In The "onRelease" Function To Match With The "i" In Another Array?
Aug 21, 2009
How do I get the "i" in the "onRelease" function to match with the "i" in another array? When I click the "ch_mc" button, the aVar array all returns "0".
nor = new Array();
nor[0] = a_mc;
nor[1] = b_mc;
nor[2] = c_mc;
I want to loop through an array of mc's, and assign each a onRelease function. I have the following code but the trace inside the function doesn't seem to find the array.I understand why but what is the correct way of doing this?
ActionScript Code: var theArray:Array = new Array(); var j:Array = new Array();[code].......
I have the problem with creating multiply functions. I want to create onRelease function for every item in array that will navigate to specific URL from xml.Here is the code:
for(var i=0;i<numOfItems;i++) { var t = home.attachMovie("item","item"+i,i+1);[code]....
The problem is that the trace for url will work if I put nodes[0] for example instead of [i].
I have two arrays. One contains numbers and the other contains strings. I want to do a sortOn(DECENDING) for the number array and then have the string array sort to match. if my string array is
If you have an array with six numbers, say: public var check:Array = new Array[10,12,5,11,9,4]; or public var check:Array = new Array[10,10,5,11,9,4]; How do you check for a match (of a pair?)
Code: var s:String = '%include %unquote(&open.gtestit&close);'; var re:RegExp = /([%&]?w+)/g; var a:Array = s.match(re); trace(a.join(' '));
I'm splitting the string up into words (w) where the word might have an optional % or & in front of it. The output is what I expect:
Code: %include %unquote &open gtestit &close
Is there a way to get the index of each matched string in one call? I know I can walk the original string using the resulting array and get indexes, but was hoping there was something similar to MATCH(). Something like:
i'm trying to use an array to match up with a variable from an .asp page.. that is, i want to load a particular .swf file based on that returned variable.I'm not sure that loadMovie even supports this kind of tomfoolery... anybody out there who be's smarter than me know?
Code: var swfs2Load=new Array("sin.swf","flirt.swf","entertainment.swf","dizzyfunk.swf","aura.swf","privilege.swf","envy.swf"); function dayTest(){ _root.maincontent_mc.loadMovie(swfs2Load[getData.day]) } getData = new LoadVars(); getData.load("whatday.asp", getData, "GET");
i'm trying to use an array to match up with a variable from an .asp page.. that is, i want to load a particular .swf file based on that returned variable.I'm not sure that loadMovie even supports this kind of tomfoolery...
Code: var swfs2Load=new Array("sin.swf","flirt.swf","entertainment.swf","dizzyfunk.swf","aura.swf","privilege.swf","envy.swf"); function dayTest(){ _root.maincontent_mc.loadMovie(swfs2Load[getData.day])[code].....
[code]I want to input a number and find a match for the number, returning the values on the row in to specific fields for each number. For example, if I input the number 10 in an input field, I want the number 1.2276, 0.00100, 106.38 and the rest of that row to output these values I have seen so many options, don't know where to start.
How to compare a string with strings inside an array for a match? I have a file in which each sentence (or word) (generally string) is present in a new line. Opened the file and read the contents to a string.
Code: private function readHandler(event:Event):void{ _str = _readStream.readUTFBytes(_readStream.bytesAvailable); _strArray = _str.split(" "); //contains each string that appears in a new line _length = _strArray.length; [Code] .....
But this doesn't work. Seems like if(_input == _strArray[i]) never gets executed even if they are equal. What might be the problem. Is there some better way to so it?
I'm stuck on this tutorial trying to learn how arrays functions. My task is to declare a variable, write an array, loop through the array and output the match in a textfield already created on stage. This code does that, but it gives me the match in number, instead of writing the name I get the number from the array, 2. How can I get the textfield to display the name Stian?
var bestevenn:String = 'Stian' var mineVenner:Array= new Array();mineVenner[0]='Janne';mineVenner[1]='Liv';mineVenner[2]='Stian';mineVenner[3]='Henri
Assuming the nextSound() function looks the same as playSound, typewise... The button click works fine, but the event listener won't call the function because its sending an argument the function isn't expecting. I can change the nextTrack function to be evt:Event, but then the button is sending not enough arguments, and I can't find anything to type it to that will work. I can make a typed function to call the un-typed nextTrack function from the event listener
public function callnextsong(evt:Event):void{ nextTrack(); }
I would like to push a value, anything really, into my array when my movieclip is pressed. I have a number of fish movie clips, and when I press them they unload, but I would like for every press of the movie clip instance a value to be pushed in the array. This is so that when a certain number of fish have been pressed the movie goes to the next frame. So, I give an if statement to say if the array has a certain length, go to nextFrame();.[code]
I have two arrays. One is used for button names and the other is used for the links for the buttons. The buttons are generated dynamically with attachMovie and the names are also modified via AS. My problem comes in at looping through the links array and applying them to the buttons.[code]
I need help with onRelease after using loadMovieClip function. onRelease doesn't work on duplicateMovieClip. The code:function buildGallery (page Position)[code]
I am designing and coding a navigation menu at the moment, and so far I have got the button instances to duplicate for each of the menu items, and set widths, positioning values and RollOver/RollOut functions. However, I would ideally like to include the onRelease button functions in the for loop too - as they are all the same apart from the variable "i". Here is the code snippet:
ActionScript Code: for (i=1;i<(_root.noofmenuitems+1);i++){ duplicateMovieClip("mc", "mc"+i, i);
[code]...
Now my problem is that by the time the onRelease function is called, the for loop has been completed and the value of i returned is the last i value from the loop (_root.noofmenuitems+1). The this["mc"+i] part obviously works, because the trace function is called when I click any of the menu items.The problem is that I have 6 menu items, and when I click any of them, the trace function returns "test 7" - not the corresponding i values for each button.
I need the following script to run as soon the as the play head comes on the frame. Right now it is activated through an onRelease...need to replace that:
myButton_btn.onRelease = function() { tweenBall(mx.transitions.easing.Strong.easeOut); }; function tweenBall(easeType) {
I need the following script to run as soon the as the play head comes on the frame. Right now it is activated through an onRelease...need to replace that:
I'm creating an image gallery and the below code is what I have come up with to create a 'container' movieclip which dynamically adds a number of thumbnails, each as a separate movie clip, one after another vertically inside the container (which is contained inside a 'main' movieclip - note the existence of mc1 is to enable me to mask the container - this is worknig so you can disregard it).(Note the number of clips is currently hardcoded to 7)
Code: image = new Array(); //array of movie clips to be contained imgLink = new Array();
i have a movieclip on the main timeline, and inside that mc I have 1 button on first frame and 1 button of second frame...From the main timeline i run this script for frame 1 button...
And this works fine.. however, i run the exact same script for the button on frame 2, ofcourse changing the path and gotoAndStop(1) instead... And this isnt working.. The button's over frame works so its activated...
Just getting up to speed on looping and incrementing variables. A real time saver.I have a onRelease function that I would like to apply to several button objects:
I need the p variable as well as the target but1 to increment. This is my first attempt:
for (n=1; n<=23; n++) { phase1a.but[n].onRelease = function() { p=[n+1];[code].......
I get a good trace on n showing that the incrementing is successful but nothing on p when the button is clicked and no execution of the function thisImage(). Not getting any errors either. Can you not loop an onRelease statement?
I am working in CS4, but using as2 as the publish setting since the swf I need to load in was previously done in as2.I have an interface that I am loading a logo.swf into. This logo has animation that works properly both in test and in the browser. There is, however, a function in the logo.swf that is not working.
When I test with the IDE this is clickable within the interface, but when I view via the webpage it is not. AllowScriptAccess was set to sameDomain, but I have also tried that set to always.
I can't get my getURL to work. It works when I use "_blank" but not when I use "_self" or "_parent" or "_top" or leave it empty. I've got it right off the main timeline. I've also tried putting it within an onRelease function.
So, this doesn't work: Code: getURL("images/aboutus.jpg", "_self"); But this does: Code: getURL("images/aboutus.jpg", "_blank");