ActionScript 3.0 :: Two Buttons For A Single Function?
Oct 5, 2010
I have the following scenerio, a main.swf which loads swfs on top, code below
stop();
var Xpos:Number = 0;var Ypos:Number =0;var swf:MovieClip;var loader:Loader = new Loader();
var defaultSWF:URLRequest = new URLRequest("swfs/home.swf");
[code].....
View 7 Replies
Similar Posts:
Feb 21, 2012
My problem is that I am trying to use the following functions on 10 different logo movieclips. Each logo movieclip has a popup up box (another mc) within its timeline with a description in. When I hover over the logo movieclip i want it to call the forward frames function and on hover out call the rewindframes function.
function forwardFrames() {
onEnterFrame = function () {
if (_currentframe != 15) {
nextFrame();
[code]....
View 4 Replies
Sep 18, 2007
I have a single movieclip named button, and I want to use a "for" to multiply that movieclip, that way I can have multiple buttons and edit them all in a single function.
It would be something like this:
var _button = new button;
for(i=0; i<5;i++){
_button[i]:button = new button;
addChild(button[i]);
}
View 4 Replies
May 16, 2009
What I have done:
1/ A very simple Flash movie
2/ 5 very basic rollover buttons
What I want to happen:Everytime I'd hover the mouse on each button, I would like the background animation to run. And have the animation stop on mouseout for each button.I was able to make it on one button via this tutorial: [URL]But this doesn't seem to work with multiple buttons involved.
View 1 Replies
Oct 26, 2010
I'm really new to flash, and just taking an intro level course at the moment.Anyways, for one of my projects,I wanted to load some .jpg files onto the stage, and make buttons from certain aspects of the image.So for example,I have an image of a coconut that I wanted to make a button out of.Right now I am trying to use the pen tool to outline the shape of the coconut, and then create a symbol from the pen tools shape.However, I'm obviously not doing something right, as when I turn the image into a symbol, instead of creating a button symbol from my outline with the pen tool, it just turns my whole .jpg file into a symbol.
I want to be able to make multiple clickable buttons from a single image,I know how the coding will work once I can make the individual buttons, but right now I seem to be missing a step.
View 1 Replies
May 9, 2010
I'm new with AS 3 and I'm struggling with this: I have five different movieclips in a single frame and I want to asign the functions "roll over", "roll out" and "press" to every single movieclip. Now, I write all the code in the frame, for the five buttons, but just one works, I don't know what am I doing wrong, here's the code for two of he five buttons, the first works fine, the second doesn't:
[Code]....
View 0 Replies
Dec 31, 2007
I have a 400x300 area that needs to detect a rollover and animate several buttons, text fields, etc. sliding into it when the mouse rolls into the area so that they can be manipulated, and animate them sliding out when the mouse rolls out of the area to hide them from view. (example here: [URL])
What is the best way to do this? The only way I have got it to work so far is by using a listener to track mouse position, but it's not reliable since you can move the mouse quickly in some areas of the movie and the listener doesn't catch it.
[Code]...
View 1 Replies
Oct 12, 2009
I have 16 movieclips, each with different instances and linking to htmlsI owuld like to have it so that when you ROLL_OVER a movieclip, they shift position 1 along the x and 2 along y axis.I've given each MC a ROLL_OVER event listener and know I could call separate function for each but I'm sure there's an easier way.This is what I have already have
Mc1.addEventListener(MouseEvent.CLICK, go1);
Mc1.addEventListener(MouseEvent.MOUSE_OVER, nudge);
Mc2.addEventListener(MouseEvent.CLICK, go2);
[code]......
View 2 Replies
Jun 26, 2009
I am trying to have one single loader for different buttons to load their specific target. lets say I have btnOne and btnTwo, each of them have their page to link to, btnOne to pageOne, btnTwo to pageTwo, page one and two are external swfs. so can I load them into stage by sharing one single loader?
this is simply my script:
ActionScript Code:
var swfURL:String = ("external.swf");
btnOne.addEventListener (MouseEvent.CLICK, startLoad);
btnTwo.addEventListener (MouseEvent.CLICK, startLoad);
[code]....
View 2 Replies
Jun 26, 2009
I am trying to have one single loader for different buttons to load their specific target.lets say I have btnOne and btnTwo, each of them have their page to link to, btnOne to pageOne, btnTwo to pageTwo, page one and two are external swfs. so can I load them into stage by sharing one single loader? this is simply my script:
[Code]...
View 2 Replies
Dec 6, 2010
how to limite a drag function to a single direction? which means I only can drag the button to left, it won't be able to drag to right.
View 4 Replies
Aug 20, 2011
I have created a custom component that I am using, more conveniently, as a SkinnablePopUpContainer and I want to use the same function that calls and receives data from it for several Buttons in the UI. What is the best way to achieve this without having to create a new function for each button?
<fx:Script>
<![CDATA[
import spark.events.PopUpEvent;
[Code]....
View 2 Replies
Sep 21, 2009
I have a movieClip. It has two children, a rectangle shape on layer 2, and a textfield on layer 1. The movieClip is used as a button.
The problem is that the textField and the rectangle are firing mouse "over" and "out" events individually. I want the movieClip to function like the old ActionScript 2 movieClips--as one single button.
I tried
ActionScript Code:
mynew_mc.mouseChildren = false;
but then the movieClip did not respond to any mouse events.
View 7 Replies
Jul 26, 2010
This is hard to describe in a sentence, so i'll write some false code: (with incorrect syntax, of course)[code]...
Is it possible to do something like this, where I pass the name of the data Type that I want it to create and it does it within the function? And I know that with this simple example it isn't necessary to do it this way, but in the full program this would save some time and make the code more efficient.
View 7 Replies
Sep 14, 2010
Is it possible to pass multiple progressEvent output into a single function...
then assign each events properties such as bytesLoaded and bytesTotal to a variable?
I'm loading images from an xml file into the URLrequest. LoaderOneURL is the location of the image. I'd like to combine the progressEvents to make one single preloader out put. I've create an example of where i am at below.
How can i differentiate between what event is being passed to the function.
I'm thinking functions are not capable of this but i'm not 100% sure. What other method could i use to accomplish this?[code]...
View 1 Replies
May 31, 2008
Is it possible to assign several onRelease Functions for multiple movieClips on a single function?
Here is my scenario... I have 10 movieClips on stage... i have a function on script which needs to be called every time any of the movieclips are clicked.. do i have to write a separate movieclip.onRelease function for each and every movieclip.
View 4 Replies
Sep 20, 2007
I need to write a function which should fix the location of the movie clip on the stage.
public function setCoOrdinates(xpos:Number,ypos:Number,movieName:S tring):Void
{
eval(movieName)._x=xpos;
eval(movieName)._y=ypos;
}
My function is as above. While I use this function in flash I only see the last movieclip on the stage which was passed. Movieclips passed earlier seem to have disappeared from the screen.
setCoOrdinates(20,200,"bButton_mc");
setCoOrdinates(530,100,"fButton_mc");
I see only "fButton_mc" on the stage. Even though I set different xpos and yposs for the movie clip.
View 1 Replies
Apr 20, 2011
I'm new to AS3, and can't figure out why this loop isn't behaving the way it "should."
[Code]...
How can I give each anonymous function a reference to each object represented by f, rather than a simple reference to f each time? Specifically, why is it that each copy of the anonymous function gets bound to a single reference to f? How (I should say why) exactly does AS3 differ from JavaScript in this regard?
View 1 Replies
Nov 20, 2009
I am putting together a simple flash anim - and pretty much have about 25 buttons that I need to fade in and out on rollover. I seem to remember there is a way to apply the same function to all buttons - as long as the over and out state labels within the mc are the same.
View 8 Replies
Nov 16, 2008
I have three buttons. My goal is that each button will load and play a sound file from the internet. Here is what I have:
function loadPlaySnd(pSpecifier1:String):void {
arguments;
SoundMixer.stopAll();[code]....
Every Button I press goes to the same sound file. The best I can figure, is that the file I loaded the first time I pressed a button has been uploaded, and from there I cannot load another file over that variable when I try another button.
View 2 Replies
Mar 9, 2009
What I have is a series of buttons created via attachmovie based on XML nodes. I want to make sure all buttons are all clicked. What I have below is the onRelease of the button and I need to put my checkDone function in there because of the XML onLoad function. What I am struggling with is how to check if each has been clicked. Typically I would just do like but1==true but that does not seem to work.
_root["but"+b].onRelease = function() {
function checkDone(whichbut) {
done = true;
[code]....
View 2 Replies
May 11, 2010
I've got 2 buttons. I need it to function like radio buttons. When one is clicked I need the other to automatically be invinsible.
if echeck_mc is visible I need echeck_mc to be invinsible. If I'm doing this wrong (marked in red) how should this be coded.
this.check_btn1.onRelease = function() { _root.glv_mc.rotate_mc1._visible = !_root.glv_mc.rotate_mc1._visible; _root.ltab_mc.echeck_mc._visible = !_root.ltab_mc.echeck_mc._visible; if (_root.ltab_mc.echeck_mc._visible = true) { _root.ltab_mc.tcheck_mc._visible = false; }};
View 3 Replies
Oct 11, 2010
One of the things that I love about AS 1/2 is with scrpt assist on, the ability to click a box and assign an action to a button (over, rollout, rollover, click, etc.). With action script 3, at least in CS4 that interaction isn't there and you have to write the code.I'm wondering if in CS5 there is that ability with AS3? Am I the only designer who misses this function.
View 1 Replies
Jul 24, 2009
I have a group of 50 buttons (named Bottle01 > Bottle50) that I want to have the same code on. The code I want is to, when pressed, put the buttons individual name into a variable and then move to a point later in the timeline. I have just started using as3 as I need this to work through Air and have been googling all afternoo and have cobbled something together, but it doesn't seem to work that well. This is the code I have sofar which is probably very wrong:
[Code]...
View 2 Replies
Mar 1, 2011
I am using isdown method but i am also familiar withe switch and case i already made the KeyObject.as and the human.fla[code]...
View 0 Replies
Jun 7, 2011
I have 30 buttons on the stage each with a different instance name.
ActionScript Code:
private function init(e:Event):void {
removeEventListener(Event.ADDED_TO_STAGE, init);
btnArray = [h1_btn, h2_btn, h3_btn, h4_btn, h5_btn, h6_btn, h7_btn, h8_btn, h9_btn];
for each (var btn:*in btnArray) {
btn.addEventListener(MouseEvent.CLICK, checkClick);
btn.buttonMode = true;
[Code] .....
Not all of them only a snippet. Is there a short way of doing this. The only prob is each function will have a completely different piece of code in it eventually doing different things. I have 20 mc with 30 btns in each.
View 9 Replies
Oct 22, 2004
I am building an interactive world map, and for ease of updating am slapping all the functions in a frame on the main timeline.
Say I have a the word "Belgium" with a generic button symbol underneith it (instance name of Belgium of course), and also the maps shape of Belgium, as a button labeled, say Belgium_Map , each requiring several functions for rollovers, movement etc, is it possible to simple write one expresion and apply it to both buttons?
My code looks something like this:
buttons.belgium.onPress = function(){
map:scale_target = "250";
map_target = "-1050";
map:y_target = "-280";
[code]....
So can I apply it to my completly separate button with the path map.europe.belgium as well, without having to write out all that crap again for each, when they execute the same things?
View 2 Replies
Aug 14, 2007
I have the following function, basically a whole lot of ohter things happens onRollOver and onRollOut but pretty sure it's here I need to edit. I have 5 mc's on the stage called 'btn1', 'btn2' etc.[code]As I said there is other bits and pieces that happen, but what i want to achieve is btn2, is actually just going to an external link, but at the moment I don't want it when pressed to play.Is there anyway to keep it as part of the function, but if btn2 is pressed NOT to play?
View 1 Replies
Oct 5, 2009
function clicked(e:MouseEvent):void {
if(a == 0){
Tweener.addTween(circle, {scaleX:5, scaleY:5, time:0.5, transition:"easeOutElastic"});
Tweener.addTween(circle, {x:middleX, y:middleY, time:0.5, transition:"easeInOutBounce"});
a = 1;
}else if(a == 1){
[Code] .....
The addEventListener will be in a forloop and applied to all the circles that are created. But how do I have the function apply itself to all the circle(s). How do I send an "circle" array as an argument or whatever it's called to that clicked function.
View 10 Replies
Oct 22, 2004
Say I have a the word "Belgium" with a generic button symbol underneith it (instance name of Belgium of course), and also the maps shape of Belgium, as a button labeled, say Belgium_Map , each requiring several functions for rollovers, movement etc, is it possible to simple write one expresion and apply it to both buttons?Im sure, like most things that one gets stumped on, it is pretty simple, however Im not sure of the syntax..My code looks something like this:
buttons.belgium.onPress = function(){
map:scale_target = "250";
map_target = "-1050";
[code]......
View 2 Replies