ActionScript 3.0 :: Finding Out Which Movie Was Clicked?
Oct 4, 2009
Let's assume that I've got 3 instances of a movie, each labeled team1, team2, team3. In this movie is a BUTTON (named buttonTest) and a TEXTFIELD(teamReply).
I'd like to write a function in the root that the event listener from the button within the movie would call on, but how do I find out 'which button' was pressed dynamically in order to send a line of text back?
For example: if the team2.buttonTest button was CLICKed, how do I pass that information onto the function to tell the function to send the text BACK to that same movie?
View 1 Replies
Similar Posts:
Feb 17, 2011
I am importing multiple class instances into my document class. They are buttons that I want to load larger images when clicked. The problem I have is that I don't know how to tell class instance was clicked to load the appropriate larger image.
this is how I am importing the buttons:
ActionScript Code:
package {
public class DocumentClass extends MovieClip {
private var myProj:Content;
[Code]....
I worked with trying to assign myProj.name but I understand in AS3 that isn't the best way to go about this. I also worked with trying to populate an array but I wasn't sure how to get the addEventListener to work when one of the class instances in the array was clicked.
View 1 Replies
Jan 12, 2012
have a loop that creates buttons. Each button stays on the screen, but scrolls off, meaning there are at any one time upto 4 buttons on the screen. There are a total of 241 buttons.t is to my understanding that using an array will allow me to access these buttons later, and that is great, but I can not find a way for it to tell me exactly which button was clicked.Am I missing something very simple here?
if (canAdd == true)
{
canAdd = false;
[code].....
View 1 Replies
Jun 15, 2009
I need a skip intro link in my movie that, when clicked, goes to the last frame of the movie and plays it.
View 7 Replies
Jan 30, 2011
Is there any way to find out about all the objects being on the stage?I mean, all nested in other movieClips or Sprites too.I can find children of specific object by looping it with getChildAt(), but of course I would have to do this for all the objects in their levels that they are nested in..
View 2 Replies
Oct 5, 2009
Wat's the difference between to find angles of two points which is (x1,x2) and the other point be (_xmouse,_ymouse).
To find the angles we subtract from one point to the other
like
method 1:
target x = (_xmouse - mc._x)
target y= (_ymouse - mc._y)
[Code].....
View 1 Replies
Aug 31, 2006
how I can find the original stage size of an SWF that has been loaded into a parent clip via MovieClipLoader? In the child clip, there are a number of elements that extend beyond its stage, so when I check the _width and _height properties, then they include the stage overlap.
I tried using mc.getBounds(), but it doesn't seem to give me what I'm after.
View 3 Replies
Jan 8, 2010
Im making a game, where a player controls a character moving around the screen using the mouse.the player moves using a tween, using the current x y pos and the click x y pos to move the character around here's the thing, i have objects on the screen (such as rocks, etc) that i do not want the user to be able to walk through. i do not want to use hit test to simply chuck the character off the object in real time because that's messy and it would mean the tween continued and stuff.. instead, i want to add some code to the top of the "movePlayer" function that checks to see if an object (such as some rocks) is going to be hit, and if it does, i want the tween to only go to this point (yellow in the below diagram)
Here's what i mean:the player clicks on the screen ( the blue dot) and instead of walking straight to the blue dot, the code determines the point at which the player will hit the big orange block, and only tween to that point, if there are multiple orange blocks in the way, the tween will stop the closest block.
View 9 Replies
Apr 6, 2011
How do I find the total maximum width and height of a movie clip with respect to every frame of that movie clip?
So for instance if the movie clip was circles of radius 5 registered at their center at various positions where:
frame 1:circle.x=-30
frame 2:circle.x=0
frame 3:circle.x=30
The total maximum width of movie clip would be 30--30+5+5=70.
View 1 Replies
Jun 26, 2009
Hi, I'm making a simple target shooting game in Flash CS3, and need to know how to make it so when you click on a movie clip, it adds 1 to a dynamic text box reading 00.
View 1 Replies
Feb 23, 2010
How could you place a movie clip on a click in the same position you click?
View 11 Replies
Feb 19, 2009
I want to link a button to a movie clip, but it will not play. Here is how it is set up. On my main scene on second layer on frame 2, I have a movie called homeContent within which I have another movie called pdbutton within which I have another movie called pdrbt. This movie called pdrbt needs to play a movie on the main scene on layer content on frame 3 movie called streetSidemc_mc. Here is my code,
function playMovie(event:MouseEvent):void {
pdrbt.play();
}
pdrbt.addEventListener(MouseEvent.CLICK, playMovie);
View 2 Replies
Apr 12, 2009
On looking into buttons, I understand that to get a movie clip to play when a button is clicked you simply place the movie clip on the buttons 'hit' state. Having done this it does not work? Have I read wrong? Also the movie clip has a background the full size of the stage area. So when I attach this to the button, the button changes size to the same size as the movie? (i.e. whole stage area). How do I keep the button in it's original size while still playing the movie clip with large background?
View 2 Replies
Jul 28, 2009
I want to know what the parent of my click button is. Reason is that I have two almost identical MCs, each with 5 buttons in them and they load different things, depending what the parent is.
Here is what I have:
function tickClick(e:MouseEvent):void
{
trace("tickClick " + e.currentTarget.name);
[Code].....
I can't get the ifStatement to trigger. What am I missing? case1FLVs is the instance name of he MC holding the buttons that trigger this function.
View 3 Replies
Nov 1, 2009
Im trying to load a movie clip when a button is clicked
heres the actionscript im using
on (release) { this._parent.loadMovie("Video.swf", "holder", 1); holder._x = 611; holder._y = -92;}
i want the swf to load into the holder MC, instead its loading the video.swf file and replacing the original swf
View 1 Replies
Jul 9, 2010
I have an AS2 project with two scenes, Scene 1 is has a pre-loader and Scene 2 has an embedded .flv animation from after effects with some other basic tweened shape layers and masks. I've used the Components UI and dragged a "Replay" button to the last keyframe with a separate actions layer with the following code:
stop();
Replay.addEventListener(MouseEvent.CLICK, replayMovie);function replayMovie(evt){gotoAndPlay("Scene 2",1);}
I'm a beginner in Flash and have been following instructions off the net but I can't get it to Replay the movie when the button is clicked, it does nothing.
View 2 Replies
Aug 31, 2005
I normally write javascript code, so I wonder how to do this. In JS "Microsoft IS" you'll write code like this:
document.onclick = func;
function func()
{
var obj = event.srcElement; //And there I have reference to the object;
}
The graphic designer creates flash drawings and then converts whatever objects to movieclips. Then passes them over to me. All these "mc" need the same action applied to them. So I don't need to know how many they are or their names.
View 4 Replies
Mar 2, 2006
When you click on a button it loads the movie clip that is on the main timeline. What I want to be able to do is when you click on another button the movie clip that you are on reverses and the new movie clip loads up.
View 4 Replies
Sep 16, 2007
Im breaking my heart to try and figure this out. Basically I have a movie clip (Test), which I want to jump to a specific frame when one of 7 other movie clips are clicked. I can get it to work when I tell it to just go to a specific frame. But when I try and create and array for each of the frame numbers nothing happens.The script I have is as follows:
[Code]...
View 6 Replies
Jan 13, 2009
what i want to happen: when you click on gallery -> then bfa, it shows a list of names (movie clips). when you rollover a name, it plays a yellow fade in and a fade out on rollout. when you click a name, it opens an external movie clip that takes up the fullscreen. i want the movie clip that was just clicked to stay activated (yellow - to show that you already viewed this one) but still be clickable.
[Code]....
the this.enabled = false; keeps the name yellow but once you click it, you can no longer click this link. i think i'm really close and i hope I explained this as clear as possible. i just need to know what script would keep the movie clip stuck on the out.
View 1 Replies
Apr 6, 2009
I have a movie clip that i want to use for a button, so that when it is clicked it will move from scene1 to scene2
is there a way to make it change when the movie clip is clicked or is it only possible on a button? i want to use a movie clip because my "button" animates when the mouse hovers over it.
View 5 Replies
Aug 21, 2009
I am trying to show a movie if the button clicked on is in my array...
ActionScript Code:
function showmenus(e:Event):void {
//store my buttons in an array
var threecolorbuttons:Array = ["menusilver33940mm3c", "menusilver343mm3c", "menugold33940mm3c"];
//loop through all buttons of movie and if theyre in array show 'myMovie'
for each(e.target.name in threecolorbuttons) {
myMovie.visible=true;
}}
However this presents me with the following error....
Error: Error #2078: The name property of a Timeline-placed object cannot be modified.
at flash.display:isplayObject/set name()
at newchip_fla::MainTimeline/showmenus()
View 4 Replies
May 26, 2003
if i wanted to disable something like a movie clip from being clickbale (i have already linked it to a function) if i want to diable the movie clip form being clicked unless something else has been pushed how would i do this and where would i put it? also if its not too much trouble could you explain the code a little bit
View 3 Replies
May 3, 2008
a gallery, i done the the roll over and roll out effects by using this keyword, now i want to add a + symbol over the imagewhen the image is clicked when the user clicks again the images with symbols it should clear the + symbol from the images,
View 8 Replies
Oct 22, 2002
I have a mc inside a frame on the main time line. a button on the main time line. i want to play the movie each time the button is clicked. another situation is i hv loaded a movie using loadMovie command. i want to play it again. currently i m using unloadMovie & loadMovie in succession. is there any other way of doing it...
View 4 Replies
Apr 10, 2009
I'm using a movie clip as a button to show content on a page, effectively its like a new page of the website. Problem is, with the script im using for it, once the content is show, the button is still active and if clicked again, will re-load the content. I want a way to effectively disable the button whist the content is shown.
this.services_inner.buttonMode = true;
this.services_inner.addEventListener(MouseEvent.MOUSE_OVER, rollOver_services);
this.services_inner.addEventListener(MouseEvent.CLICK, onClick_services);
[code]........
View 11 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
Sep 24, 2011
I am trying to build a website, and here is the logic behind my problem. I have 2 button, when user clicked on button 1 i load movie clip from library with: _parent._parent.cont.attachMovie("Page1", "e", 0, {_x:-265, _y:-250}); when user clicked on button 2, i load other movie clip. Problem: i want remove last movie clip after user clicked on button 2 and then load new movie clip but i cant...
View 9 Replies
Jun 12, 2008
not sure how difficult this is going to be, but I have 30 movie clips, which will all be sequentially numbered. (pos1, pos2, pos3......pos30). They will all have the same functions, with the only change being the number. I know there is a more efficient way to write this code using arrays, but I will need help with it. I would rather have 10 lines of code than 150. I also need help with writing the code, that will disable all other movie clips, once the first one is clicked. Also, not sure how tricky the javascript part will be. Below is the code i am trying to achieve, but the long version.
[Code]...
View 1 Replies