ActionScript 3.0 :: Simple Button Command Using Root
Jul 9, 2010
I want to make a MovieClip called "menuText" go to and stop at frame 2 on the click of a button thats in another MC.
This "menuText" MC is on the _root, but i know you cant use "_root" anymore with AS3, although i think you can use "root".
This is what i have:
ActionScript Code:
home.addEventListener(MouseEvent.CLICK, onClickNextSlide);
function onClickNextSlide(event:MouseEvent):void{
root.menuText.gotoAndStop("2");
}
Whats wrong with that code? The button is called "home" by the way.
View 2 Replies
Similar Posts:
Feb 21, 2011
I signed on to this adobe forum hoping some one can help me. Ive created a navigation bar in Flash CS5.
Ive got my up, down, hover states to work perfectly but the state hit i just cant seem to figure out what it does. What im looking for, is for someone to help me with, when a user lets say clicks on 'Home', i want that link to stay 'red' so that user knows its on 'Home Webpage'.
I dont know if i have to add code in flash for it to do that or if its done by the hit function. Because ive set which colour hit should be, but when i hit/activate the 'Home Webpage', it wont stay a solid colour, to show its active. It just goes back to its original colour after doing hover/down/hit.
View 5 Replies
Aug 5, 2010
Well i have an adobe air which runs vlc-player at background as service. i check that in Windows Task Manager , the service runs when air application launches.
here is the code
processArgs.push("--extraintf");
processArgs.push("rc"); //Remote control
processArgs.push("--rc-fake-tty"); //Use terminal as output
[code]......
View 1 Replies
Mar 2, 2011
I want to call 3 commands one by one , the relation between each commands are command should execute one by one in the previous command result. How to Queue Command's? What is the best practice to handle Queue command , my requirement is adding n number of commands and execute them.Main -> Execute c1c1 got the Result - Execute c2c2 got the Result - Execute c3
View 2 Replies
Mar 22, 2010
I want it so that when you click a button, it will run a multiplayer game and connect to a server, WITHOUT having any .bat or .exe files beforehand. So any new guy can rock up and connect, just as long as he has the game.
If you run Jedi Academy multiplayer like this:
jamp +set fs_game "japlus" +connect "193.155.0.5:29070"
It will run the game and connect to a certain server. The problem is, how do I get Flash to do that without any premade .exes with command lines?
The only other problem I can think of is, is it possible to run the game without knowing the directory the exe is in? In other words, could Flash find the game .exe if it was just given a name?
View 1 Replies
Jan 20, 2010
I have a total of 11 buttons each named b1, b2, b3 etc. I used to have it so when the a button is clicked, the button was recognized as to which one it was through an array and string and switch statement (I will show you below). But now I have to introduce something in the middle and so I am not sure how to make it work any more.
Code:
public function addButtonEffects():void {
//the buttons used to lead to onButtonClick as you can see here
//but now I need them to lead to closeShutters and from there go to onButtonClick
b1.addEventListener(MouseEvent.CLICK,onButtonClick);
[Code].....
View 7 Replies
Oct 26, 2009
I have found this fine example for multilanguage choice:URL...I have changed initLanguageSelector() to this:[code]It works OK with button component but I need it to work with simple movieclip or button.
View 2 Replies
Dec 4, 2008
I made a script for the file that i am working with that hasbuttons located within 2 movieclips. I want that button to load andimage into a UILoader (problemLoader_mc) that I placed on the stageon the main timeline (the timeline that contains WeekBar_mc). Theproblem is that I don't know how to get to the root of the file tostart a new directory to tell my function to load the image i want.I have tried multiple approaches including:
MovieClip(root).problemLoader_mc.source = problemArray[0]
MovieClip(parent).problemLoader_mc.source = problemArray[0]
root.problemLoader_mc.source = problemArray[0]
[code]......
View 5 Replies
Feb 29, 2004
is there a function or a method to call every button in a MC or root?
View 3 Replies
Jan 24, 2012
There is a div in my project, and this project is on-line. Inside this div there is a space that is made in flash (actionscript 3), inside this space we have to sign a contract with the mouse. How can I save this signature without an options window to choose where I want to save this signature?
(The button to save the signature is made in flash too).
View 1 Replies
Jun 15, 2009
I have in root, two MCs1. MC is my content that a horiztional pan of multi MCs within the "content MC" 2. I have a MC that should function as a button each button linking to example "b3" for which b3 is on _root within "content MC" panel b3.PS. If I simply label the instance of the MC button "b3" this will play _root "content MC to that panel" However, I lose my animation on the button MCBelow is my _root code for (content MC)
Code:
var currentPosition:Number = contentHold.content1._x;
var startFlag:Boolean = false;
[code]....
View 3 Replies
Jan 7, 2009
I've a button in MC1 (MC1 is resting in root) and I want it to take another MC2 (also resting in root) to go to a certain frame.. the instance name for MC1 is 'blah1'
How'll i make the button in MC2 to take MC1 to lets say frame#10.. ?
View 4 Replies
Jan 7, 2009
I've a button in MC1 (MC1 is resting in root) and I want it to take another MC2 (also resting in root) to go to a certain frame.Supposing, the instance name for MC1 is 'blah1'.How'll i make the button in MC2 to take MC1 to lets say frame#10.. ?
View 4 Replies
Apr 1, 2009
I have created an interface that uses a lot of the loadMovie command using levels. Once I have loaded a movie on say level 3...in that level 3 movieclip I will have another navigation that will load and then use the loadMovie command to load movie on level 3 as well. It loads it correctly but the back button that would contain the unloadMovie(3) command isn't unloading, say if the user wants to go back.
View 2 Replies
Feb 13, 2006
I have a photographer's portfolio site in the works. I'm using loadMovie connected to thumbail buttons of each photo to show a larger version of the photo. Here is the script[code]...
Now the photographer would also like to have a next/previous arrow buttons so the user can click through like a slide show. Is there a way to have Flash know what movie is currently loaded and based on that information go to the next or previous?
View 1 Replies
Mar 6, 2009
I have a game with two joysticks and I use the dispatchEvent command to send the fire button event. What would be a good way to send the number of the joystick to check who pressed the fire button. A bit dirty way would be to save just the number in root or in my main class.
View 1 Replies
Apr 21, 2003
My problem is that if i do an drop-menu-animation and i put it in my button, i can't manage the command LoadMovie, in the primary stage of the site...
What should i do?
View 1 Replies
Apr 13, 2004
How can I get a button to work when its nested in a MC that has an onEnterFrame with a onPress command targeted to it?
Here's the code for my "popup" MC located on the main timeline.
popup.onEnterFrame = function(){
this.onPress = function() {
this.startDrag(false);
[code]....
Within that same MC is a button that tells it to close. However, I run a trace command to it and nothing happens. It seems like the onPress nested in the onEnterFrame is over-riding my button on(press).
View 3 Replies
Jul 14, 2009
I am creating a flash site, and inside my frame label for lets say "pageA" the movie clip begins In pageA, fades up shows the content and stops(); alowing for the page content to be read.
After reading, the viewer clicks on the button inside the nav bar, to take them to say "pageB" i now want "Page A" to fade out and then root to "pageB
my thinking is that i insert a stop on the time line of the movieclip, then when the button is pressed it plays, lets say, the remaining 10 frames in the clip (the fade out), and then roots to pageB.
i just need a simple actionscript to do that, if there is an easier way, any one who could point that out and end my misery is a god/godess respectfully!
View 2 Replies
Oct 18, 2009
I want to tear my hair out and cry! I've just upgraded to CS4 and am trying to create a simple swf that consists of a root timeline with various frames, each labelled 'home', 'bio' & 'contact'. There are buttons on the stage with instance names and then on the first frame of my root timeline I have the following code (as well as the _root.stop() as actionscript on the labelled frames):
Code:
_root.stop()
homebtn.onRelease = function():Void {
[code].....
View 2 Replies
May 26, 2010
I'm running flash cs4. I have an xml file I've loaded in but cs4 actually takes out the root nodes. So now I've been trying to add them back in when a button is pressed but I can't do it. I looked at creatElement and appendChild functions they seem to be what i need but I can't get them to work.
View 1 Replies
Oct 31, 2011
If I have a movieclip on the main timeline, and a button in that movie clip. How would I go about getting it to advance the main timeline to its next frame? I understand that in AS3 movie clips are not connected to the timeline in the same way as they are in AS2 but I dont understand why the following works, or if there is a better way?
stop();
next_btn.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler1);
function mouseDownHandler1(event:MouseEvent) {
MovieClip(this.root).nextFrame();
}
View 2 Replies
Oct 1, 2009
I have some submenu buttons in a movieclip on the mainline. My first level of navigation in on main timeline. The submenus are grouped in movieclips on the main timeline. I basically used the same code on the main navigation for the sub navigation except the code for the submenus is in that movie clip. My trace statement reads the button is clicked (which was a quantum leap for me) but I know I need some kind of _parent code in there so it knows to go to label back on main timeline.[code]...
View 3 Replies
Jan 21, 2008
//This is my original code which works fine when my button is present on the root timeline
btn_up.onRelease = function() {
getURL("javascript:Launch('website.html', 2000, 1200)");
[code]....
View 2 Replies
Jan 9, 2006
I'm new to Flash and am looking to use the following tutorial to create an advanced button. I know it is probably a very simple fix, I just cannot figure it out. [URL] In the tutorial the rollover and onrelease has the following script this.onRollOut = function(){ rewind = true;} this.onRelease = function(){getURL [URL]); } I have tried to change the on.Release command to go to and play another frame in to movie instead of opening a new url. But I'm not getting it to work correctly.
View 4 Replies
Oct 11, 2009
Draw a rectangle using the rectangle tool; select the text tool and create a text box inside of the rectangle, and type in BEGIN; make sure it fits inside the rectangle; select entire image by left clicking then dragging over it; convert to symbol button.
Then, I add in the code of going to keyframe 4 when released (which works fine). But when I test it out and mouse over the button, I can still select the text which gives me like barely any space where I can click the button to go to keyframe 4. This is reeaaallly annoying me. How can I fix this?
View 1 Replies
Jul 30, 2010
I am using Adobe Flash CS4. I don't know why I do the sample actionscript code here.
on (release) {
gotoAndPlay(1);
}
And now I'm dealing with a button function. I already created a box then press "F8" and choose button. Now I click on the button box, and press "F9" for the actionscript. It said that "Current selection cannot have actions applied to it" Then choose "ActionScript 1.0 & 2.0" Global Function > Movie Clip Control > On but "On" is disabled, how to solve this problem of mine to put this simple code.
View 1 Replies
Jul 9, 2009
i'm using flash cs3.i was using flash 8.i used to just put this code on a button, and worked, no problem.[code]now, i can't put code on a button... got some code on another site... seems i have to put code in an actions layer, and give the button an instance name![code]
1. this doesn't work
2. the older way seems alot easier and does work.
3. how can i just use the first method?
View 1 Replies
Sep 21, 2009
I have got a simple button in the first frame of my flash file, but its not wokring. Here is the code I am trying.
Code:
Btn.addEventListener (MouseEvent.CLICK, myFunction);
function myFunction (e:MouseEvent):void {
trace("working");
}
It gives this error: "The class or interface 'MouseEvent' could not be loaded"
View 3 Replies
Jan 21, 2010
So I am trying to get better at putting all my code within one action layer and there is a bit of button code that seems to be confusing me.
Whenever I program a button I use the following code:
PHP Code:
on (press){
} on (release, releaseOutside ) {
}
Now I know programming the on(press) command is done like this:
PHP Code:
btnName.onPress = function() {
}
However I am having a hard time with the on (release, releaseOutside ) code. The only way I have been able to do it is like this:
PHP Code:
btnName.onRelease = function() {
} btnName.onReleaseOutside= function() {
}
My question is, is there any way to combine the two onRelease commands?
View 2 Replies