Actionscript 3.0 :: Button Functions On A Different Frame?

Feb 5, 2009

I am having trouble with defining buttons I have on a separate frame. I define the buttons in my main class on my first frame fine, I have a mc called buttons and then on frame 1 I have some buttons and on frame 2 I have a button called btspin.

so when I have the following:

buttons.btspin.addEventListener(MouseEvent.CLICK, spinmouseclick);
function spinmouseclick()...

in the class it doesn't work. And that makes complete sense to me.

So what I did instead was keep those functions still there, but I moved the listener into a function that is called once you get to the second frame. The function is called fine but when referencing the button inside that function I have a problem:

function spinmouseout(e:MouseEvent):void {
//Change BT Color
buttons.btspin.buttoncolor.transform.colorTransform = new ColorTransform();
}

when called mc-buttons is on the right frame it gives the error:

TypeError: Error #1010: A term is undefined and has no properties.
at MethodInfo-11()

View 1 Replies


Similar Posts:


ActionScript 2.0 :: Functions And Sub-functions - Button Doesn't Work OnRelease?

Jun 17, 2004

I have one function that puts text in a text field and makes a button goto a url onRelease.The code is like this:

Code:
item.onRelease = function() {
myButton.onRelease = function() {
getURL("http://google.com", "_blank");
}
talk = this.txt;
}
the only problem is that the button doesn't work onRelease. i think that it is because there are too many functions there, but at the same time,

View 5 Replies

ActionScript 1/2 :: Frame 7 To Have A Clear Code That Will Remove All The Functions From Frame 6?

May 15, 2010

i have As code with functions on frame 1-6 i want on frame 7 to have a clear code that will remove all the functions from frame 6. I need only the AS code to be cleared on frame 6 no where else... so the functions that are there no longer work in the rest of the animation.

View 4 Replies

ActionScript 3.0 :: Multiple Button Functions - When Click The Button, The Mc Does Not Stop Playing And The Text Does Not Show Up?

Nov 8, 2009

I'm designing an interface for a class, and the buttons that I am using all have multiple functions.For example, when the story button is clicked, I need the mc to stop playing and change to text (in the same window/screen, just no mc playing).  The mc is 31 frames long, but if there's a way to just make it loop continuously until told not to, Currently, my code looks like this:

stop();
story_btn.addEventListener(MouseEvent.CLICK,story);
function story(event:MouseEvent):void { gotoAndStop(32);}credits_btn.addEventListener(MouseEvent.CLICK,credits);[code]...

When I click the button, the mc does not stop playing and the text does not show up. 

View 6 Replies

ActionScript 3.0 :: How To Remove All Functions And Pic MC On Frame 5

Jul 28, 2009

I have this function in my 1st frame
Code:
Select allfunction DisplayPic(evt:Event):void {
if (typing_txt.length==10) {
var pic_mc:MovieClip = new MovieClip();
var temp_mc:MovieClip = new card();
pic_mc.addChild(temp_mc);
pic_mc.x = 316.8;
pic_mc.y = 244.8;
addChild(pic_mc);
stage.removeEventListener(Event.ENTER_FRAME, DisplayPic);
}
Isn't the event listener removed? When I use gotostop ("frame5") it still works in the 5th frame and the pic_mc will still appear on "frame5". May I know how to remove all the functions and the pic_mc on "frame5"?

View 2 Replies

ActionScript 3.0 :: Duplicate Functions - Cant Re-use Enter To Go To Frame 15?

Jul 15, 2009

Im trying to use keyboard events to goto specific frames in my flash file for example i want to use the enter key to go to frame 5 and from 5 i need it to go to 15. here is my code:
 
 stop();stage.addEventListener(KeyboardEvent.KEY_DOWN, onKeyPressed);function onKeyPressed(evt:KeyboardEvent):void { switch (evt.keyCode) { case Keyboard.ENTER: gotoAndStop(5); break;
 case Keyboard.RIGHT:nextFrame();break;[code]....
 
 Everything works fine except i cant re-use enter to go to frame 15.

View 8 Replies

ActionScript 2.0 :: Can't Get Functions To Work After Re-entering First Frame?

Jun 11, 2008

I don't know what's going on here. I have some onRelease functions on movieclips that work fine. However one of them takes the user to a contact form in another frame but after selecting another button to go back to the first frame of the movieclip none of the functions work again.Here's a link to my swf so you can see what I mean:

http:[url].....It's kind of glitchy because it's on deviantart and I took out a lot of stuff so the .swf would be smaller.And here is the action script I'm using:

Code:
stop();
Stage.scaleMode="noScale";
Stage.align="TL";[code].....

I'm thinking because the actionscript is located in the _root of the whole .fla and all the action is happening in the img movieclip that something is off.

View 2 Replies

ActionScript 1/2 :: Multiple OnRelease Functions - Submit And Go To Next Frame

Jun 21, 2011

I have a problem with a contactform in flash. The form and the script works fine, but I want to add a function. When pressing the "submit button" it sends me an email. And the text "message sent appears. I would like to add a onreleaseandgotoandplay function which takes me to the frame 2. I have tried to place this function into the button, it works fine taking me to frame 2, but then it does not send me an email....

Actionscript
bSubmit.onRelease = function(){email();
}function email(){
var sMessage = "Name: " + tName.text + "
E-mail: " + tEmail.text + "
Comments: " + tComments.text + "
[Code] .....

View 1 Replies

ActionScript 3.0 :: Creating Entire Classes Within A Package That Contains Normally In-frame Functions?

Jun 16, 2011

When I create anything in a library, it's basically a class right? Meaning I can do essentially the same thing with use of a package in an AS file? In AS 2.0 this would probably mean I can add specific functions on this class as I can do when I use flash's object interface and add script to the specific class object itself. However, in AS 3.0 you cannot attribute code directly to an object right?

This leads me to my second question. I basically want to create a flash mp3 player (I've coded this already), but make it so that it is an entire package of contents, so I can add it to my website when a mouse event is detected and then take it off the website once it's no longer needed (to conserve memory and assure an overall nice experience). The problem is that I have many objects and subsequent functions (play button, pause button, etc), and want all of this to be contained in one file. Is this even possible?

View 3 Replies

ActionScript 3.0 :: OnRelease Functions (Contact Form) Submit And Go To Next Frame

Jun 21, 2011

I have a problem with a contactform in flash. I have a working contact form made in flash , which I want to add a function to. When pressing the "submit button" it sends me an email. And the text "message sent appears. I would like to add a onreleaseandgotoandplay function which takes me to the frame 2. I have tried to place this function into the button, it works fine taking me to frame 2, but then it does not send me an email....

Actionscript
bSubmit.onRelease = function() {
email();
} function email() {
var sMessage = "Name: " + tName.text + "
E-mail: " + tEmail.text + "
[Code] .....

View 3 Replies

ActionScript 3.0 :: Multiple Onrelease Functions (Contact Form) Submit And Then Go To Next Frame?

Jun 21, 2011

I have a problem with a contactform in flash. I have a working contact fom made in flash , which i want to add a function to.When pressing the "submit button" it sends me an email.And the text "message sent apears. I would like to add a onreleaseandgotoandplay function which takes me to the frame 2. i have tried to place this function into the button, it works fine taking me to frame 2, but then it does not send me an email.I guess the second function should be placed in the code below to work

View 7 Replies

ActionScript 3.0 :: Execute Functions In Document Class When Main Timeline Reaches A Frame

Oct 16, 2009

I have 3 functions in my main document class that I want to execute when the main timeline reaches a particular frame number. how do I do that? see the code and comments

[Code]...

View 2 Replies

ActionScript 2.0 :: OnEnterFrame Inside A Class - Functions CharactercamX And CharactercamY Are Not Running Every Frame

Apr 15, 2009

I've been trying to run some functions in my class every frame and have come up with this code:

[Code]....

I get no errors, but the functions charactercamX and charactercamY are not running every frame.

View 3 Replies

ActionScript 2.0 :: Make A Button That Makes Got To A Random Frame Within A Certain Range (eg Frame 41-50) When Press It?

Aug 17, 2009

I want to make a button that makes you got to a random frame within a certain range (eg frame 41-50) when you press it. I have tried various codes but so far no luck. Im using AS 2
and the button is within a couple of movie clips, but you can still click it when you test

View 1 Replies

IDE :: "this" Inside Functions - Change Button State When Mouse Is Over A Button

Sep 3, 2009

Let's say I have 3 buttons (movieclips) and, using AS2, I want that when mouse is over a button, that button changes its state, something like

[Code]...

so that the same thing happens for each button when the mouse is rolled over it, by simply calling for each button a function inside which I refer to the button by using "this". And the problem is I cannot (don't know) how to do this in AS3. I mean if I use "this" inside a function, this refers to the main timeline. So is there a possibility to write a function like

[Code]...

View 3 Replies

CS3 Typing-Button Interaction - Only Plays Next Frame And Then Goes Back To The Frame Where It Stopped

Mar 20, 2010

I hit enter,it only plays next frame and then goes back to the frame where it stopped. What I've tried was something like:

stop();
Key.addListener(Key.ENTER)
if (Key.isDown.ENTER){
play();
};

I want it to play all the way to the end,not just go back.

View 1 Replies

CS3 Delay - Button To Play Frame 10 To 40 Then After Playing From Frame 10-40 The Movie Stops

Jul 3, 2010

how to code this on a button

onrelease
gotoandplay(10); // i need delay here before activating the next code below//
gotoandplay(80);

the trick is.. i want the button to play frame 10 to 40 then after playing from frame 10-40 the movie stops and then play frame 80 to 100

View 4 Replies

ActionScript 1/2 :: When Click The Shift Button,it Shows The First Frame Static Of The Movie Clip In Frame 3?

Feb 23, 2010

I have a character, And in its movieclip I`ve got 3 frames (first has an idle pose, second a walking pose and third a running pose), each with a movieclip with an action in it.Well, what I wanted is that when I am walking with this character, and press the SHIFT key he runs.And I`ve got the following code

if (Key.isDown(Key.LEFT))[code]....

But when I click the shift button, he shows the first frame static of the movie clip in frame 3 (running frame).

View 9 Replies

ActionScript 2.0 :: 2 Functions To One Button?

May 2, 2006

i have to scripts each in a different movieclip, i have

Code:

_root.navigation_n_logo["next_btn"].onRelease = function() {
nextImage();
};
and

Code:

_root.navigation_n_logo["next_btn"].onRelease = function() {
galleryChoice(2);
};

so as you see, I want both functions to execute on the same button but it only does 1. how can i fix this? so that both functions execute on the same button/movieclip

View 4 Replies

ActionScript 3.0 :: One Button To Do Two Functions?

Jul 14, 2009

How could I code one button to do this

var showpage:Loader = new Loader();
var url:URLRequest = new URLRequest("fade.swf");
on1.addEventListener(MouseEvent.CLICK, showPage);

[code]....

And the Very Same button when clicked again to do this removeChild(showpage);Pretty much, What I have is a lightswitch, and when you click it, A black Fade appears arounf my FLVplayback.. And I want it, to where you click it again, the Black fade goes away..I can do this with two different buttons.. But was wondering if at all possible with one button.

View 1 Replies

ActionScript 2.0 :: Button Cannot Run Two Functions?

Apr 25, 2011

I have a button which should generate a salt mc and statin mc, but when i put the generating loop on the main timeline and run the function from the button it doesnt work. PS. i need the generating funcion on the maintime line as I need to remove the mc when I click the 'reset' button and also do hittests with the mcs

View 1 Replies

ActionScript 2.0 :: Playing A Movie Clip From A Certain Frame To A Certain Frame With A Button

Jan 7, 2009

I have an invisible button and only one mc, the mc loops 3x then stops, this is defined with as in mc.

Now i want to play the movie from the invisible button but only loop it once. Which means i would like to play it from frame 1 to frame 215.

And also when u rollout i would like the movie to stop and go to frame 1.

this is my button code so far

Code:
on (rollOver) {
tellTarget ("loader")
{

[Code]......

View 12 Replies

ActionScript 2.0 :: Make A Fade In Of Button In Only One Frame Of Frame Root?

Jan 14, 2009

i have one button (enter_btn) inside of one moviclip(enter_mc), and I need to know how to call the button through my frame root?

I use one movieclip only to make a fade in of my button in only one frame of my frame root.

[Code]...

View 4 Replies

ActionScript 2.0 :: Target Path - Go To Frame 2 When Click On Button On 1st Frame

May 25, 2009

there is a button on 1st frame. there is a movie clip on frame 2. I named the movie clip as "ball_mc" I want to go to frame 2 when I click on button on 1st frame. I know that the code "gotoAndPlay(2);" on button will work. But for some reasons, i want to try another way.... i tried several codes:

1. this.ball_mc.gotoAndPlay();
2. _level.ball_mc.gotoAndPlay();
3. _global.ball_mc.gotoAndPlay();
4. _root.ball_mc.gotoandPlay();

However these codes dun work. Is there other way to resolve this besides this code "gotoAndPlay(2)"?

View 1 Replies

Frame Jumping - Click On Button 1 > Plays Frames 10 - 15 > Goes To Frame 20?

Oct 11, 2010

I have 5 different buttons for the navigation on my flash website.The first page is on frame one.When you click on any of the 5 buttons I want it to play frames 10 - 15 before moving to which ever frame the button 1-5 corresponds to. So:

Click on button 1 > plays frames 10 - 15 > Goes to frame 20
Click on button 2 > plays frames 10 - 15 > Goes to frame 30
Click on button 3 > plays frames 10 - 15 > Goes to frame 40 etc

How do I make this work?

View 3 Replies

ActionScript 2.0 :: Button Play A Frame And When It's Stopped Jump To Another Frame

Sep 6, 2011

I built a button in one of the movie clips in my project,

when I release this button, it goes to the 41st frame of the main timeline and continue to play until the frame 70 which has got a stop; command. till here everything's just OK. But I want this button to do something more though I don't know whether it's possible or not.

I want this button to go and play the frame number 41 in the main timeline, and then after it stopped at the frame 70 , then jump to frame 73.

View 5 Replies

Professional :: Why Isn't The Button Making The Screen Change From Frame To Frame

Jun 15, 2010

I've been following the book "Beggining Flash Programing for Dummies" and I have come up to a part where I create a very simple game.
The script involved in the frames are FRAME here:
 
stop();
btnGoThere.onRelease = function(){   _root.gotoAndStop("there");
} //end event handler
 
Frame there
 
btnGoHere.onRelease = function(){    _root.gotoAndStop("here");} // end release
 
When I test the movie and click the button, the frames don't seem to change.

View 12 Replies

ActionScript 3.0 :: From Button Click Event - Play To Certain Frame Then Go To Another Frame

May 25, 2011

I have a small flash site made up of a number of pages all on the one timeline.

The query is this. When i release a button i want the timeline to roll on for x frames (fading components out) before going to the frame that button links to (The beginning of the new page).

I have no idea what AS to use for this.

No matter where in the timeline you are, the button should fade out that area and then skip to a new one.

View 2 Replies

ActionScript 2.0 :: Button On Frame 4 Telling Flash To Go To Frame 5

Nov 20, 2006

I have a problem where I have declared an onRollOver event handler on frame 5. I also have a button on frame 4 telling flash to go to frame 5.But, if the mouse is already over the movieclip on frame 5, the rollover event will not play.Is there a way to force this onRollOver or another workaround for this?

View 1 Replies

ActionScript 2.0 :: GotoAndPlay A Particular Frame (frame A) When The Cursor Is On A Button

Jul 10, 2007

I am making a website with a flash menu. I want it to gotoAndPlay a particular frame (frame A) when the cursor is on a button. When you roll the cursor off of the button I want it to gotoAndPlay a different frame (frame B). That part was easy enough. But here is the problem. If you click on the button I want it to continue playing frame A even when you roll off.

View 3 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved