ActionScript 3.0 :: Flash For Loop + Getchildbyname - Trace What Button Is Clicked
May 20, 2011
I have made 30 movieclips for my level selection screen. Then I create a movieclip with the same name using a for loop. With that code I make roll_over function showing a Tooltip. I then want to trace what button is being clicked. My whole code is here: [URL] I want to trace what button is clicked, so I can show it on my tooltip textbox.
View 4 Replies
Similar Posts:
Oct 28, 2008
I'm trying to use XML to load in 4 images to a movieclip within a movieclip that is already created on the stage. I'm trying to do this in a loop since there are 4 movie clips I'm trying to access. I can get it working without the loop, but it's figuring out the syntax that's causing the problem. Currently I have the following code:
function ParsePics(picsInput:XML):void {
var picsList:XMLList = picsInput.pic.image;
for (var i:int = 0; i < picsList.length(); i++) {[code]..............
View 4 Replies
Feb 23, 2012
I have many buttons in my flash, its function is when a button is clicked it will animate. The problem is when I click the button, it animates, but when I click it again, it does not animate. It should animate again when clicked. Someone told me to have a loop so that it will animate again but I have no idea regarding looping in flash.
Here is my actionscript:
stop();
custom_btn.addEventListener(MouseEvent.CLICK, custom);
function custom(event:MouseEvent):void {
gotoAndPlay(2);
stop();
[Code] ......
[URL]
View 6 Replies
Oct 5, 2007
i just want that when i click the duplicated MC then it will trace "button1 clicked" then the other goes also like that...here is the code...
[Code]....
View 3 Replies
Nov 3, 2010
All i really want to do is be able to affect multiple movieclips at once with event listeners and greensock tweens.
The first snag I hit was that I couldn't create references to movie clips using the old [] Associative array referencing method. Maybe I still can with AS3, but I couldn't get it to work...
So I found another technique using getChildByName that returns a reference to a movie clips and allows me to store that reference in a variable.
However, the movie clip I'm trying to affect with an event listener resides inside of another movie clips, so to build the address (aka, root.mc1.m2.mc3) to the mc I want to get to is proving to be difficult. (I'm very new to AS3...)
I thought the trace(target1_mc.target2_mc.name); at the bottom of the following code would output the name of target2_mc but it doesn't.[code]...
View 2 Replies
Nov 3, 2010
All i really want to do is be able to affect multiple movieclips at once with event listeners and greensock tweens.The first snag I hit was that I couldn't create references to movie clips using the old [] Associative array referencing method. Maybe I still can with AS3, but I couldn't get it to work..So I found another technique using getChildByName that returns a reference to a movie clips and allows me to store that reference in a variable.However, the movie clip I'm trying to affect with an event listener resides inside of another movie clips, so to build the address (aka, root.mc1.m2.mc3) to the mc I want to get to is proving to be difficult. (I'm very new to AS3...)I thought the trace(target1_mc.target2_mc.name); at the bottom of the following code would output the name of target2_mc but it doesn't...[code]
View 2 Replies
Apr 10, 2010
I've got an intro for a movie,and a single button appears around frame 58,and I've tried giving it a function so it will skip to fram 478 and play the whole movie from there on:
PlayCompl_btn.onRelease = function() {
gotoAndPlay(478);
}
but it keeps saying "statement must appear within handler" and I've got the same problem when the movie reaches frame 477 I want it to go back to frame 58 and play from there so it would loop all until the button is clicked:
PlayCompl_btn.onEnterFrame = function() {
gotoAndPlay(58);
};
View 9 Replies
Nov 3, 2010
I was wondering if it was possible to use a for (or for each) loop to trace the properties of an event to the output window. I know I can trace the event in one go, like this:
[Code]...
View 1 Replies
Mar 16, 2012
I'm getting the geolocation data of a viewer and creating a textfield to display this data (city,state). After the data is pulled the text is measured to fit in the textbox and if the length of the city is too long, the text is adjusted in size to fill the textfield. When I trace the end result of the final text size, I keep getting the (same) trace result outputted infinitely.
[Code]...
It worked, but I needed the text box to be made according to what data was pulled from the geolocation xml, so I added it in the geolocation script.
View 1 Replies
Mar 4, 2009
I've been trying in as3 to create a trace function which traces / outputs which instance in my movie i have clicked, but with no luck.
I have 10 MC's on my stage, and I would like to trace which of these I clicked, outputting ie. "_level0.myButton09".
View 1 Replies
May 18, 2011
How can I reorganise the code below so the trace commands output i for each element in the photourls array and not just the last element? In a 6 element array, the trace(i); line outputs 5,5,5,5,5,5 rather than 0,1,2,3,4,5.
[Code]...
View 2 Replies
Nov 8, 2011
I am building a simple game in flash in actionscipt 3. I want when the user click on the 3 movieclips on the stage to trace a message like "Thanks for clicking all 3 movieclips!"
this message have to appear once he click on the 3 not only on one.
View 2 Replies
Sep 29, 2008
How can I make it stay the rollon color after it's clicked and then the rolloff color when another button is clicked?
[Code]...
View 7 Replies
Jun 9, 2010
I have 4 navigation button and like home, about us etc.... And i want to disable home when it is click and cannot clicked it until the user click another button first. means if a visitor is at home page then home navigation is disabled, and all other are active, and when they click at aboutus button then the pages goes to the about us page and the about us button is disabled and other get active. I want this solution in AS3 with oop concept.
View 6 Replies
Feb 7, 2007
I've got about 6 buttons laid out, one on top of the other in a list format. In their normal state the buttons are grey in colour, when I rollover them, the buttons flash and turn to orange. Now, what I need to happen is this: I want the buttons to stay orange once clicked and only roll out back to grey when the user has clicked on another button in the list. I've been told that the best way to do this is via adding a listener, however I am a little unsure as to how to go about this. I've checked the flash help file and have a basic understanding of how listeners work...but can't really wrap my head around applying it to this situation. Perhaps I will need to have all the buttons as separate broadcasters?
View 2 Replies
Mar 9, 2010
I have 20 players in a game and cutting and pasting lots of code except for a few numbers. I have future features that would require over 400 lines of mostly repeated code. So I learned how to use "for", and practiced with a trace command. Traced the results exactly as I thought. However when I apply it to the guts of my function, the movie breaks down. I suspect it's because the function is being called on an EnterFrame command and the for loop I wrote is being executed over and over.
This works when I hand code:
Actionscript Code:
function drill(){GUESS0 = ((guess0min * 60)*1000) + ((guess0seconds * 1000))
GUESS1 = ((guess1min * 60)*1000) + ((guess1seconds * 1000))
GUESS2 = ((guess2min * 60)*1000) + ((guess2seconds * 1000))
GUESS3 = ((guess3min * 60)*1000) + ((guess3seconds * 1000))
GUESS20 = ((guess20min * 60)*1000) + ((guess20seconds * 1000))
//and then 300 more lines of other code}
And then a button later calls this when pressing:
Actionscript Code:
my_MC.onEnterFrame = function(){_root.drill ();
//so _root.drill is continually being called, which is good, because it has all sorts of data that needs to be refreshed, but I think it's screwing with my "for" loop.}
And the following is NOT working.
Actionscript Code:
function drill(){for (i=0;i<20;i++){
"GUESS"+i+" = ((guess"+i+"min * 60)*1000) + ((guess"+i+"seconds * 1000));";}
But when I trace it in a separate test movie, it outputs exactly what I would hope it placed in the code:
Actionscript Code:
for (i=0;i<5;i++){trace("GUESS"+i+" = ((guess"+i+"min * 60)*1000) + ((guess"+i+"seconds * 1000));");}
So at the end of the day, I guess I can trace these results in a test movie and use it to generate what I need, and cut and paste it into the project... but I thought 'for' loops were for saving time AND space. Am I using this code right? Maybe my use of "", or +, or i is misguided?
View 4 Replies
Aug 27, 2011
I've got something simple in my main time line. I know I must be missing some kind of loop function, as the hold down doesn't work unless I keep clicking. And my trace doesn't work unless it starts on the 'enemy'. I'm just not sure what
Code:
import flash.events.MouseEvent;
_left.addEventListener(MouseEvent.MOUSE_DOWN, moveLeft);
function moveLeft(e:MouseEvent){
_hero.x--;
[Code] .....
View 6 Replies
Apr 12, 2011
I want to get some flashVars parameters, but have a hard time getting them into any variable.
When using the following code :
[Code]....
the values are shown inside the SWF as expected. However, when adding a trace in the for loop, nothing is there.
Why is this, and how should I retrieve the variables?
View 6 Replies
Jul 7, 2010
I have many MovieClips and each has a name like "mcDummyClosed" and then and instance name "slideDummyClosed". Another MovieClip has a link to e.g. slideDummyClosed which I then call DummyClosed. I add a MouseEvent.CLICK event to DummyClosed.
Now without adding slideDummyClosed to the stage nor any other MovieClip can I with a string containing it's name get that instance? I've tried using getChildByName() but that only seems to work if I've already added the MC to be found and added before. My code looks something like this:
[Code]...
View 2 Replies
Feb 18, 2009
How do I assign a value to a radiobutton when it's in a for loop to then trace out the value when radiobutton is clicked? I got this now, but it just sets all the radiobutton values to 10..
View 8 Replies
Dec 17, 2004
I have a menu with five nav buttons (atcually MovieClips). Each has three frame labels: "on", "stay", and "off". The rollover and rollout animations play flawlessly, but I'm at a loss as to how to give each button a sticky "active" state. I'd like the button to stay in it's active state until another button is clicked, then I would like it to play it's "off" animation. Each MC has this code:
[Code]...
View 2 Replies
Oct 23, 2009
I used the tutorial here: [URL] to achieve the above, which I did. Then I tried putting AS on the buttons I made to import external clips and they stopped working completely. I've tried putting the AS on the main time line as well as on the btn itself, I've even tried recoding the script from the tutorial. I've attached the file which should work to me. if the btn code is deleted from the main timeline the menu acts as it should but doesn't link any where.
View 1 Replies
Apr 22, 2011
My document class is Main.as (it extends MovieClip). The following code is in my Main.as.I've declared all these variables in my class definition:
private var holder:MovieClip;
private var leftButton:SimpleButton;
private var rightButton:SimpleButton;
[code]....
View 2 Replies
Mar 15, 2008
Am working on a website and just doing the final tests and evrything works apart from in internet explorer 7 when i click on the hyperlink( flash button) it says it can't find the url, which doen't make any sense as it works fine using mozilla.
View 1 Replies
Jan 29, 2010
it possible to create a button in flash that when clicked the flash interface extends to fit fullbrowser?
View 4 Replies
Jan 18, 2011
I am facing a weird problem. The following code returns null if targeted player is Flash player 9 but works fine for Flash Player 10.
[Code]...
It works fine if I give a delay using setTimeout. I am not sure what I may be doing wrong. I have attached the source files. (Flash CS5 format)
View 5 Replies
May 17, 2011
I want to play a movie clip when I click a button.I made 3 states: inicial (how it looks before anything happens) (up)hover (plays an animation after waiting 20 frames) (over)click (plays an animation right away) (down)I placed these movie clips inside of my button's up, over, and down frames. This works great except when I click, i'll need to click and hold for my animation to get past the first frame.
View 1 Replies
Jul 27, 2011
I have a Flash movie to be displayed in fullscreen on a kiosk. Also, It needs to run in a browser window because I'm using JavaScript to reload the page for resetting the movie.
The problem is, it doesn't go fullscreen when I put the following line to the constructor:
stage.displayState = StageDisplayState.FULL_SCREEN;
But it works fine if I put the line to a button's click handler.
Note: It doesn't work if just call the handler function with a null parameter.
How can I make it fullscreen as soon as it opens?
View 3 Replies
Oct 12, 2010
i'm building an projector application in AS3, as a slide show.When the right and left keys are pressed on the keyboard, the slides change.the code to change the slide:
Code:
function setup() {
stage.addEventListener(KeyboardEvent.KEY_DOWN, displayKey);
}
setup();
[code]....
Some slides have button on it, that change the slide, jumping to a chapter the user whant to see.the problem i'm having is that when the button at a slide is clicked, the key press detection does not work anymore. To make it work, I have to click somewhere on the stage.
View 1 Replies
Apr 27, 2011
I'm aware this sounds quite involved, but would it be possible to make a Flash button counter that would store the number of clicks (that it displays) on a remote server; so even if the page was closed and re-opened it would still show "2" or "11" for example. In addition to that, would it be possible to only allow one click per IP address? So for example, one specific IP address (user) couldn't keep clicking it over and over and increasing the number.
The reason I wanted to use a Flash object as opposed to something like jQuery was because I want to embed it on a forum that isn't mine. Obviously I don't have access to the site's files/modules etc. Essentially it's almost like the Facebook "like button." It displays the number of likes, as well is storing the value on a remote server.
View 1 Replies