Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Flash








Button Click Function


I am using a button to control a movie with Tell Target action.

What I want to do is use the ON PRESS command to play the sequence of my movie that flips a card.

Then

ON PRESS (2nd time) plays a sequence that reverses the flip.

Is there a way to set the second click that the user makes on the button, behave differently than the first one?

Thanks in Advance.




FlashKit > Flash Help > Flash Newbies
Posted on: 03-28-2005, 02:55 PM


View Complete Forum Thread with Replies

Sponsored Links:

Function Activate Only On Button Click
is it possible to make fuction activate only(to make it not activated if button is not pressed) when button is pressed and how to do it?

i guess if that is possible i would have to create something like this(dont know how or is it even possible) :

Code:
function fbuttonclick(event:MouseEvent):void {
var function2:Function = function (event:Event):void {
do something
};
mc1.addEventListener(Event.ENTER_FRAME, function2);
}
button1.addEventListener(MouseEvent.CLICK , fbuttonclick);
when i do this it is activated not only on button click...function2 is active all the time

View Replies !    View Related
Function Param Same As Button Click
i need to some how make the function.call(param) the name of the button you press to call it.

that is to say if you press bh01 then the call would be vistoggle(bh01)

any thought or ideas would be greatly appreciated


Code:
import flash.display.*;
import flash.events.*;
import flash.ui.Keyboard;


function clickbh01(event:MouseEvent) {
vistoggle(player.h01);
trace(this);
}

player.h01.alpha = .0;
player.h02.alpha = .0;
player.n01.alpha = .0;
player.gotoAndStop(1);


bh01.addEventListener(MouseEvent.MOUSE_DOWN, clickbh01);

function vistoggle(item:Object) {

if (item.alpha == .0) {
item.alpha = 1;
} else {
if (item.alpha == 1) {
item.alpha = 0;
}
}
}
any ideas

View Replies !    View Related
Sending A Paramater Through A Function From A Button Click..
so i've created navigation that includes about 30 buttons.. essentially what I need to do is when a button is clicked have a paramater sent through the actionscript so that I can have only one function rather then 30 functions..

attached is my code.

thanks,
chad



Code:
import flash.events.MouseEvent;
import flash.display.MovieClip;
key01mov.stop();
key02mov.stop();
key03mov.stop();
key04mov.stop();

//sound over keys
//----------------------------------------------------------------------------------
key01.addEventListener(MouseEvent.MOUSE_OVER,keyOver01);
function keyOver01(e:MouseEvent):void {
key01sound.gotoAndPlay(2);
}
key01.addEventListener(MouseEvent.MOUSE_OUT,keyOut01);
function keyOut01(e:MouseEvent):void {
key01sound.gotoAndStop(1);
}
key02.addEventListener(MouseEvent.MOUSE_OVER,keyOver02);
function keyOver02(e:MouseEvent):void {
key02sound.gotoAndPlay(2);
}
key02.addEventListener(MouseEvent.MOUSE_OUT,keyOut02);
function keyOut02(e:MouseEvent):void {
key02sound.gotoAndStop(1);
}
key03.addEventListener(MouseEvent.MOUSE_OVER,keyOver03);
function keyOver03(e:MouseEvent):void {
key03sound.gotoAndPlay(2);
}
key03.addEventListener(MouseEvent.MOUSE_OUT,keyOut03);
function keyOut03(e:MouseEvent):void {
key01sound.gotoAndStop(1);
}
key04.addEventListener(MouseEvent.MOUSE_OVER,keyOver04);
function keyOver04(e:MouseEvent):void {
key04sound.gotoAndPlay(2);
}
key04.addEventListener(MouseEvent.MOUSE_OUT,keyOut04);
function keyOut04(e:MouseEvent):void {
key04sound.gotoAndStop(1);
}

//content click keys
//----------------------------------------------------------------------------------
key01.addEventListener(MouseEvent.MOUSE_DOWN,keyHit01);
function keyHit01(e:MouseEvent):void {
key01mov.gotoAndPlay(2);
key02mov.gotoAndStop(1);
key03mov.gotoAndStop(1);
key04mov.gotoAndStop(1);
}

key02.addEventListener(MouseEvent.MOUSE_DOWN,keyHit02);
function keyHit02(e:MouseEvent):void {
key02mov.gotoAndPlay(2);
key01mov.gotoAndStop(1);
key03mov.gotoAndStop(1);
key04mov.gotoAndStop(1);
}

key03.addEventListener(MouseEvent.MOUSE_DOWN,keyHit03);
function keyHit03(e:MouseEvent):void {
key03mov.gotoAndPlay(2);
key01mov.gotoAndStop(1);
key02mov.gotoAndStop(1);
key04mov.gotoAndStop(1);
}

key04.addEventListener(MouseEvent.MOUSE_DOWN,keyHit04);
function keyHit04(e:MouseEvent):void {
key04mov.gotoAndPlay(2);
key01mov.gotoAndStop(1);
key02mov.gotoAndStop(1);
key03mov.gotoAndStop(1);
}

View Replies !    View Related
Dynamically Add A Function / Activity On Button Click
Dynamically add a function / activity on button click

I have an assignment where I need to do additional task (say blinking a movie on button click)

I am having 15 movies.

When click on different buttons i do several actions
move them
or fill it with color.

Now I want to add "Blinking the movie " when clicked on any button

It is really painful to select each movie and add a function say blinkit()


Is it possible to define a fucntion so that this additional fuction can be performed for each movie ?

Indeed

View Replies !    View Related
Probleem Accessing Function Within Button Click
Hello,
I am a bit of an actionscript noob.
I am trying to call to a amfphp login function from within a button click event and am not having success. The code works fine if I run it outside of the click event. For example, if I run the login code during the initial loading it all works fine, but inside the click event it fails. The "handlelogin" function is never executed (at least my breakpoints within that function are never hit), but no errors are thrown and the output window reads: Calling login and then ok . Is this a scope issue or something else simple that I am missing? Any help greatly appreciated. My code looks like this:

There are 2 input text boxes (username1 and password1) and a button (login) on the stage. The user enters their username and password in the first 2 boxes, clicks login and their login credentials are verified by the remote Authenticate.login method which returns boolean true if login was successful.


//Set this to the location of your gateway.php file
var gatewayUrl:String = "http://myserver.com/amfphp/gateway.php";

// Import packages necessary for Remoting debugging and coding

import mx.remoting.*;
import mx.remoting.debug.*;
import mx.rpc.*;

//Start the NetConnection debugger
NetDebug.initialize();

//Set this to the name of the remote service
var serviceName:String = 'Authentication';

// Create PHP Remoting Service
var Authentication:Service = new Service(gatewayUrl, null, serviceName);

// Define result handling code
function handlelogin(re:ResultEvent) {
trace("Got result ""+re.result+"" of type "+typeof (re.result));
//this function is never called??
}

// Define fault handling code
function handleFault(fe:FaultEvent)
{
trace("There was this fault: " + fe.fault.faultstring);
}


//define button click code

login.onRelease=function(){
// Call some functions
trace("Calling login");
var user=username1.text;
var pass=password1.text;
var pc:PendingCall = Authentication.login(user,pass);
pc.responder = new RelayResponder(this, 'handlelogin', 'handleFault');
trace("ok");
}

View Replies !    View Related
Instantiating UILoader In Button Click Function
I have a weird issue with actionscript 3.0 and I wanted to see if anyone knows what might be going on.

I create a UILoader in the root layer. Then on a button click, I set it's properties and once it's loaded, I set the size and all that. It works fine.

Then I try to instantiate the UILoader in the button click method and the picture loads up enormous.

It never happens when I instantiate the root layer. It always happens when I instantiate it in the button click method.

The code is below. Does anyone know why it would do this? I traced all the properties I could think of (xscale, yscale, height, width for both the containing movieclip and the UILoader and they are the same regardless of where it's instantiated.

The code is below. Thanks for your time:


var myStage:MovieClip = new MovieClip();


var stageItem:UILoader = new UILoader();


//Button click function
function buttonClick(event:MouseEvent)
{
trace("Button Clicked " + event.target.name);

//If I instantiate the object here, the picture loads enourmous
//Take the line below out and it works fine
stageItem = new UILoader();


stageItem.autoLoad = true;
stageItem.source = imagePath + event.target.name;
stageItem.addEventListener(Event.COMPLETE,stageIte mLoaded);
stageItem.name = "firstPic";
myStage.addChild(stageItem);
}

function stageItemLoaded(evt:Event): void
{
trace("stage item laoded");
stageItem.x = 0;
stageItem.y = 0;
stageItem.scaleX = 1;
stageItem.scaleY = 1;
stageItem.height = 100;
stageItem.width = 100;
stageItem.addEventListener(MouseEvent.MOUSE_DOWN, stageItemStartDrag);
stageItem.addEventListener(MouseEvent.MOUSE_UP, stageItemStopDrag);

}

View Replies !    View Related
Sending A Paramater Through A Function From A Button Click..
so i've created navigation that includes about 30 buttons.. essentially what I need to do is when a button is clicked have a paramater sent through the actionscript so that I can have only one function rather then 30 functions..

attached is my code.

thanks,
chad









Attach Code

import flash.events.MouseEvent;
import flash.display.MovieClip;
key01mov.stop();
key02mov.stop();
key03mov.stop();
key04mov.stop();

//sound over keys
//----------------------------------------------------------------------------------
key01.addEventListener(MouseEvent.MOUSE_OVER,keyOver01);
function keyOver01(e:MouseEvent):void {
key01sound.gotoAndPlay(2);
}
key01.addEventListener(MouseEvent.MOUSE_OUT,keyOut01);
function keyOut01(e:MouseEvent):void {
key01sound.gotoAndStop(1);
}
key02.addEventListener(MouseEvent.MOUSE_OVER,keyOver02);
function keyOver02(e:MouseEvent):void {
key02sound.gotoAndPlay(2);
}
key02.addEventListener(MouseEvent.MOUSE_OUT,keyOut02);
function keyOut02(e:MouseEvent):void {
key02sound.gotoAndStop(1);
}
key03.addEventListener(MouseEvent.MOUSE_OVER,keyOver03);
function keyOver03(e:MouseEvent):void {
key03sound.gotoAndPlay(2);
}
key03.addEventListener(MouseEvent.MOUSE_OUT,keyOut03);
function keyOut03(e:MouseEvent):void {
key01sound.gotoAndStop(1);
}
key04.addEventListener(MouseEvent.MOUSE_OVER,keyOver04);
function keyOver04(e:MouseEvent):void {
key04sound.gotoAndPlay(2);
}
key04.addEventListener(MouseEvent.MOUSE_OUT,keyOut04);
function keyOut04(e:MouseEvent):void {
key04sound.gotoAndStop(1);
}

//content click keys
//----------------------------------------------------------------------------------
key01.addEventListener(MouseEvent.MOUSE_DOWN,keyHit01);
function keyHit01(e:MouseEvent):void {
key01mov.gotoAndPlay(2);
key02mov.gotoAndStop(1);
key03mov.gotoAndStop(1);
key04mov.gotoAndStop(1);
}

key02.addEventListener(MouseEvent.MOUSE_DOWN,keyHit02);
function keyHit02(e:MouseEvent):void {
key02mov.gotoAndPlay(2);
key01mov.gotoAndStop(1);
key03mov.gotoAndStop(1);
key04mov.gotoAndStop(1);
}

key03.addEventListener(MouseEvent.MOUSE_DOWN,keyHit03);
function keyHit03(e:MouseEvent):void {
key03mov.gotoAndPlay(2);
key01mov.gotoAndStop(1);
key02mov.gotoAndStop(1);
key04mov.gotoAndStop(1);
}

key04.addEventListener(MouseEvent.MOUSE_DOWN,keyHit04);
function keyHit04(e:MouseEvent):void {
key04mov.gotoAndPlay(2);
key01mov.gotoAndStop(1);
key02mov.gotoAndStop(1);
key03mov.gotoAndStop(1);
}

View Replies !    View Related
How To Call A Function To Action Without Click On Button.
Here is an example of text effector. http://mirko.highbox.net/labs/effector/

I want to make the text effect load on stage right away without click on the button to trigger the text effect action.

How can I do that?


Thank you everyone that had the knowledge about scripting could help me with this.

Best,

NB

The scripts posted below:

================================================== ====================

import effector.TextEffector;
var myCustomEffect:Object = {time:1.000, effect:"exposeline", line:1, interval:0.300, transition:"easeinoutcubic"};
var myCustomUpdate:Object = {autoClose:true, DOWN:true};
var _textString:String = "What is Flash Professional? Adobe® Flash® Professional software is the most advanced authoring environment for creating rich, interactive content for digital, web, and mobile platforms. Create interactive websites, rich media advertisements, instructional media, engaging presentations, games, and more. Designers and developers working on both Macintosh and Windows® systems depend on Flash and the ubiquitous Adobe Flash Player software to ensure their content reaches the widest possible audience. Flash is the best ";
var _textUpdateString:String = "Effector is really cool class, in next version I will setup more features which will made this class much more richer. so enjoy , next update is comming soon with more powerful features ";
var _globalDepth:Number = 0;
var _myText:TextField;
var _old:MovieClip;
var setTextOnStage:Function = function() {

if(_old != undefined) _old.removeMovieClip();

var myTextHolder:MovieClip = _root.attachMovie("textContainer", "textContainer" + _globalDepth, _globalDepth, {_x: 20, _y:20});
_old = myTextHolder;

var myText:TextField = myTextHolder.textHolder._text;

myText.text = _textString;
myText.multiline = true;
myText.autoSize = true;
myText.wordWrap = true;
_myText = myText;

TextEffector.addEffect(myText, myCustomEffect);

_globalDepth++;

}
butt.onPress = function() {

setTextOnStage();

}
butt2.onPress = function() {

_myText.text = _textUpdateString;

TextEffector.updateTextField(_myText, myCustomUpdate);

}
butt3.onRelease = function() {

getURL("http://mirko.highbox.net/labs/effector/_example.fla", "_blank");

}

stop();
================================================== ===========

View Replies !    View Related
Combine Button Double Click With Drag Function
Hi

I'm trying to combine a mc button's drag functionality with a double click functionality.

I have the actionscript to do both - with the drag aspect working fine - but I'm having problems getting the double click to work too - basically meshing the respective scripts.

Tried variations on combining the scripts but nothing working so far - grateful for any help on getting this right.

The script is below

Thanx



//double click: set initial variables
click = false;

//function for the button press
this.onPress = function() {
//if this is the first click
if (!click) {
timer = getTimer()/1000;
_root.click = true;
}
else {
timer2 = getTimer()/1000;
//if it is a double click
if ((timer2-timer)<.25) {
//toggle the box mc on and off
if (this._visible==false) {
this._visible = true;
} else {
this._visible = false;
}
} else {
timer = getTimer()/1000;
_root.click = true;
}
}
};

on (press) {
//Start Dragging Movieclip Behavior
startDrag(this, false, 168, 224, 564, 476);
this.swapDepths(this._parent.getNextHighestDepth() );
n=this.getDepth();
_root.introBox.swapDepths(n+1);
//End Behavior


}
on (release,rollOut) {
stopDrag();

}

View Replies !    View Related
I Click On A Button , A Line Pops Up Under The Button I Click On A Different Button..
anyone know how to make this work?

this is what i want , when i click on a button a want a line to pop up under the button then when i click on another botton , i want that same line to move under the new button . if some1 could do a very basic one and put the .fla file that would be perfect. thanx

View Replies !    View Related
Click Button Once - WORKS FINE- Click It Again - RESTARTS MOVIE?
Don't know if I can attach it.. Here is a link..

http://www.yourmomrocks.net/ma/tca.fla

When I set actions to a button the action works fine. However, if the button is hit a second time, the whole movie restarts. I can't figure out why? I have attached the file. Please some one help if you can..
Thanks
WORKS FINE CLICK TWICE RESTARTS MOVIE?

View Replies !    View Related
Single Click Button Requires Double Click
I noticed that some buttons in all of my .swf's were taking
two clicks to get them to work. After you double click them
once they work fine. I made a very simple movie to demonstrate
my problem. Please tell me if this problem is occuring for you also.

Thanks,
Anavrin

My .SWF file My .FLA file

View Replies !    View Related
How To Make A Button That Responds To Right Click, So That When You Right Click This
Hey, im Danief, im new to the forums.

I need to know how to make a button that responds to right click, so that when you right click this button, a goto action starts.

Ive been searching google for a freakin long time now... pleease if you know anything about it tell me.

Oh, and i also need to know how to make a timer that will start by the press of a button and stop with the press of a button.

Thanks for reading.

-Danief

View Replies !    View Related
Button Click LoadMovA..click Again LoadB?
I saw this code on the tutorials but it was in relation to Random backgrounds. Woud anyone know if I could use this to do the following....

First time a button is clicked, I want it load and play Movie A, if the button is clicked again, load and play Movie B.

Can I control where it loads? Meaning to a movieclip holder or something?

on (release) {
choice = Math.round(Math.random()*2);
switch (choice) {
case 0 :
location.loadMovie("image0.swf");
break;
case 1 :
location.loadMovie("image1.swf");
break;
}
}

Thanks

-M

View Replies !    View Related
Right Click, On Click Away Function
Hi. I would like to make it so that that when the user right clicks on my movie, and then clicks away (to hide the menu) an action happens. Is this possible? I don't care if the right-click menu shows or not, but I want there to be a function when the user clicks away.

Thanks,
Sportzguy933

View Replies !    View Related
Function On Right Click
Can anybody tell me how to a function on the right-click on a button?

Thanks for any help in advance.

View Replies !    View Related
Getting A Second Click Function
I just want to have a button go to a different frame on the second click, a person clicks to go to a frame, and then clicks again to go back to the frame it started from. Thanks anybody

View Replies !    View Related
Controlling The Right-Click Function
Hello all-

Can Flash MX control the right-click function? Right now, in a Flash movie, when the user Right-clicks the movie, anywhere on the movie, it brings up the default flash plug in dialog box (play, stop, about flash 6 player, etc). I've heard you can turn that off, but I was wondering if there was a way I could control that action, like pop up my own Flash movie clip with my own buttons in it. Like on a thumbnail image on a website that leads to a bigger image, the user can right click the thumbnail and select "Save Target As..." to save the bigger image to their disk. Can MX do this?

View Replies !    View Related
Right Click Function In Mx 2004
Hi, I'm not sure if this question was covered (tried to search for it) and if it has I apologize for posting again.
I'd like to know if the right mouse button can also be given actions like the left mouse button. If so, how can this be done. Much Appreciated.

View Replies !    View Related
[F8] Right Click Function Disable Help
Sorry, I searched for a few things first before posting, but I dont know what it's called so I was just stabbing in the dark..

I want to get rid of all the extra options when you right click on the flash movie screen. Like zoom and such.

If someone can point me to a previous thread or something, that would be cool.

View Replies !    View Related
Menu On Click Away Function
Can anyone suggest a method whereby when a user clicks on screen away from a popup menu, menu._visible = false ?

I've tried using a Mouse Listener but it overrides the mouse events for the menu buttons.

The same is true for setting background.onMouseUp = function() where the mouse events for the menu buttons are ignored.

I also tried using menu_mc.onKillFocus = function() but that didn't work.

I'm assuming there's an easy solution to this, but I just can't figure it out.

Thansk in advance for any suggestions.

View Replies !    View Related
Changing The Function On The Second Click
This is probably stupidly easy, but i cant seem to do it anyway.

I've got a button that i'm using with the telltarget command to make a movieclip play a few frames when clicked. What i want it to do is go to a DIFFERENT part of the movie clip when it is clicked a second time.

I keep trying to find this in tutorials and have failed miserably. Any help is much appreciated!

View Replies !    View Related
Similiar To Right Click Function
Well, this is something like the thread "changing quality" but i think i should not put it in the same thread! quite different in a way...
can flash do something like the right click function?
I mean make a button that can make the screen dull/half-alpha or whatever it called, when all the animation stops but only the setting appears brightly? It's like in flash, when you right click for the setting.

Thanx for any suggestion and helps!

View Replies !    View Related
Flash Right Click Function
I have been browsing a website today http://www.hellocolor.com

And i noticed when you right click theres an option to e-mail the admin, How is that done by any chance?



Thanks

View Replies !    View Related
Changing The Function On The Second Click
This is probably stupidly easy, but i cant seem to do it anyway.

I've got a button that i'm using with the telltarget command to make a movieclip play a few frames when clicked. What i want it to do is go to a DIFFERENT part of the movie clip when it is clicked a second time.

I keep trying to find this in tutorials and have failed miserably. Any help is much appreciated!

View Replies !    View Related
Is It Possible To Stop The Right-click Loop Function?
Hey,

When my website loads up after the preloader is complete it keeps repeating the animation. If I right-click on it and untick the loop function its fine... is there any way of making the site load up without the loop fuction enabled???

The site is at www.wight-image.co.uk

Any help would be so helpful as this site is a college assigment which is to be completed this week.

Thanks,

Tom

tom99@zoom.co.uk

View Replies !    View Related
Zoom (right-click) Function With A KeyPress?
I'd like to have a user be able to press + or - and have the file zoom in and out ... similar to the right-click > Zoom in/out function.

I searched around here but can't seem to answer my question.

Thanks in advance.

View Replies !    View Related
QUICK Stop On Click Function
Alright so I am trying to get a presentation from keynote to work with swf files produced from contribute (the swf file can't just be drug into keynote, you have to back save and then it doesn't include the animation files) and I have about run out of ideas. I exported the keynote presentation using .mov (the option to export as a swf hangs up my computer everytime for whatever reason) and then I brought that into flash 8 and I have one long timeline. Well it plays all the way through and I need to add stop() for each 'screen'. What I need is some sort of AS that say stop, go to next screen on a click, or keystoke, whatever is easiest. how do I write this?

Thanks so much, I am working on a deadline of only a couple of hours left.

If this doesn't make much sense I am sorry, just working under some pressure on a large presentation.

View Replies !    View Related
Make Right Click Perform Function
can you make the right click perform a function instead of showing the contextMenu?

thanks in advance.

View Replies !    View Related
How To Stop The Right Click Play Function
Hello there,
I am making a game online using flash and there are two sections, a player section, and the teacher section with private information. Well, if the player right clicks and presses play, it goes to the next frame, which is the teacher section. How do I void out this problem? Any help would be awesome! Thanks

View Replies !    View Related
Can I Reduce Function Of Movie Clip After Click?
Hi, Thanks for your help in advance

I am new to A.S., or at least this level of it but...

I need a group of buttons to perform a set of actions if none of the buttons have been pressed, and only some of those actions if any one of the buttons has been pressed, something like:

myMovieClip1_mc.onRelease = function(){
myMovieClip1_mc.gotoAndPlay(1);
myMovieClip2_mc.gotoAndPlay(1);
}

but if any of the buttons have been pressed, I need myMovieClip2_mc to stay as it is, but still have myMovieClip1_mc to function.

something like:
myMovieClip1_mc.onRelease = function(){
myMovieClip1_mc.gotoAndPlay(1);
// I need to keep myMovieClip2_mc the same, but don't know how.
}

I think I need to define a variable and then create an if/else statement to act if this variable is present, but I'm not sure if this is the best way to approach this, or if I'm even on the right track.

I thank you for the help.

View Replies !    View Related
Passing Variables To A Function From A CLICK Event?
hello,

is it possible to pass additional values/variables with a click listener.

so for example

xxx_mc.addEventListener(MouseEvent.ROLL_OVER, rollOn);

function rollOn(event:MouseEvent, numby:Number):void
{
trace(numby);
}

how do i get the number to the function?

is it like this:

xxx_mc.addEventListener(MouseEvent.ROLL_OVER, rollOn, '1234');

is it even possible?

thanks for any help

Ben

View Replies !    View Related
When You Click On A Button, The Button Grows Into A Large Box With The Content Inside
How in the world are people doing that?? Hopefully you know what I mean... and example would be right here. When you click on one of those boxes, you can open the "card" and then the white box grows into a larger box with the content inside. Is there a relatively simple way to do this?

*begging*

View Replies !    View Related
Button [ ] On Click Goto Frame 2 [X] Movieclip X Mark Button
Ok I have a movie clip first frame looks like this [ ] second frame looks like this [X] I want to apply action script to it that says on press goto frame 2. Then another that says if on frame 2 go back to frame 1! But I'm kind of lost here I don't how to make this happen!

View Replies !    View Related
Could This Be A Bug In Flash? Javascript/function For Goback Requires Dbl Click
I am trying to make a go back button. I originally tried get url and it required a double click to go back. I have since tried using a function and it works, but still requires a double click. When attempting the function with onload it goes back automatically. Does anyone know if this is some sort of bug or am I doing this wrong? Thanks in advance for any help.

the function used is as follows:
function goBack(){
history.back()
}

View Replies !    View Related
Click (and Drag) Bring-up-object In Depth Function?
I'd like to make an instance click-and-draggable (I know how to do that to an instance (startDrag("movie"), etc., but that's it). I'd like to create a global function for each object (say 3-5), so when a user clicks, it brings it to the very front and very draggable). For obvious reasons, it's a global function to call from each instance, rather than attaching nearly-duplicate on press and on release local functions to each and every instance. Well, sorta saves on efficiency, right?

Other things I'd like to see would be to have yet-more-embedded-functionality (buttons show up that are there, but disappear when you click on another instance, but that can come later. A bounding area would be nice too.

Any takers?



thanks.

View Replies !    View Related
Click Inside Flash To Trigger Html Function
Hi guys,
Does anyone know how to do this?

I wanna click on a button on a flash banner on an html page and change the default cursor to an image.

Basically i have an image that i wanna use as the cursor. but i want this this happen only when the user clicks on the button inside the banner.
Does anyone know this?

PLease Help
Jag

View Replies !    View Related
Can I Add A Click Event On Lines That Drawn In Lineto Function
hi

i need to draw lines using lineto function , thas i already know, but i question is that,
can i drag that particular line from the center of that line,like if the line is 10cm long i need to able to drag the line ny were inside 1cm to 10cm,
is that possible?

thanks

View Replies !    View Related
Mc Instance Activated By Button How Do I Unload Mc On Click Of Another Button?
I have 4 buttons each with a mc instance attached. on release of button one it plays the movie clip - eg click "about us" button plays a movie clip to open up the company details. But when you click the 2nd button "contact us" I want the first movie to disappear(unload) and the 2nd movie clip to play.

Can anyone help?
Desperate!!!

View Replies !    View Related
Making A Button Event Happen Without Click A Button
hello.

Got this script, an event happens when the user clicks
a button. The button isn't a standard movie clip button,
its a component.

No actions attached to the buttons.

There is an actions layer with the actions:

loadFeedBtn.addEventListener("click",Delegate.crea te(this,loadxml));

loadFeedBtn is the instance name of the button.

there is also:

function loadxml(p_evtObj) {
bla bla bla
}


My question, how do I make it, so that it just performs the action
that the happens when the user clicks the button, with out them clicking the button, just by them entering the frame?

Thanks

View Replies !    View Related
Trying To Get A Button To Play A Movie Clip After I Click The Button
trying to get a button to play a movie clip after i click the button. right now when i preview my web i have to hold the button for it to play and after i let it go it dissaperes. please help with flash mx. use to corel rave so simple but limited

View Replies !    View Related
OnRelease Of Button, Is It Possible To Goto Top Of Page After Button Is Click?
I would like to know a script or what ever i can use to make it that when someone click on my button, i want it to go to the top of the page, not reload the page, just goto the top... is this possible?

View Replies !    View Related
To Click On One Button And Have This Action Initiate A Buttonclick On Another Button?
I want the user to click on one button and have this action initiate a buttonclick on another button. How would I code the first button?

Thanks ...

View Replies !    View Related
OnRelease Of Button, Is It Possible To Goto Top Of Page After Button Is Click?
I would like to know a script or what ever i can use to make it that when someone click on my button, i want it to go to the top of the page, not reload the page, just goto the top... is this possible?

View Replies !    View Related
Programatically Create Buttons, Handle Click Events With 1 Function
Hey everyone, this is my first time posting here and i'm happy to be part of the community. My question is this: I am trying to make a number of movie clips that will work as buttons, all of which will look identical. I want to create them in a programmatic way(say, with a while statement), and then instead of checking for "cases" in the handler, which seems sloppy, I'd like to call one function with parameters when a button is clicked. these parameters would contain the instructions for what the function will do, for example in actionscript 2 I could write:

somebutton.onpress = function() {
clickhandler(param1, param2, param3)
}

Then have the clickhandler function take those arguments and do specific things with them. Is there a way to call a function and pass it arguments like this? Thanks ahead of time!


Here is snippets from my code (this isn't the full code; didn't want to make everyone go through the whole program to get my point)


ActionScript Code:
var buttonStateT1:String = "none";
var arraycount1:int = 0;
var tier1Array:Array = new Array(T1B1_MC, T1B2_MC, T1B3_MC);

T1B1_MC.buttonMode = true;
T1B1_MC.addEventListener(MouseEvent.CLICK, clickHandler)

T1B2_MC.buttonMode = true;
T1B2_MC.addEventListener(MouseEvent.CLICK, clickHandler)

T1B3_MC.buttonMode = true;
T1B3_MC.addEventListener(MouseEvent.CLICK, clickHandler)

function clickHandler(event:MouseEvent):void {
    trace(event.currentTarget.name);
    switch (event.currentTarget.name) {
                        case "T1B1_MC" :
            if(buttonStateT1 == "B1"){
                tier1FuncReverse(T1B1_MC);
                break;
            }
            if(buttonStateT1 == "none"){
                buttonStateT1 = "B1";
                tier1Func(T1B1_MC);
                trace("yeah1");
                break;
            }
            else{
                break;
            }
                        case "T1B2_MC" :
            if(buttonStateT1 == "B2"){
                tier1FuncReverse(T1B2_MC);
                break;
            }
            if(buttonStateT1 == "none"){
                buttonStateT1 = "B2";
                tier1Func(T1B2_MC);
                trace("yeah2");
                break;
            }
            else{
                break;
            }
           }
}
function tier1Func(bname:Object){
    trace("called t1func");
    for(var i:int=0;i<3;i++){
        if(bname == tier1Array[i]){
            trace(tier1Array[i]);
        }
        else{
            trace(tier1Array[i]);
            tier1Array[i].y = tier1Array[i].y + 8;
        }
    }
}

function tier1FuncReverse(bname:Object){
    trace("called t1func");
    for(var i:int=0;i<3;i++){
        if(bname == tier1Array[i]){
            trace(tier1Array[i]);
            buttonStateT1 = "none";
        }
        else{
            trace(tier1Array[i]);
            tier1Array[i].y = tier1Array[i].y - 8;
            buttonStateT1 = "none";
        }
    }
}

View Replies !    View Related
Button... To Click Or Not To Click
okay, I'm using Flash MX. My problem is that I have a movie clip with an action inside but it is stopped on frame 1. When it is clicked, like a button, it plays at frame 2 and goes to frame 10 where i have another "stop" action.
I want to be able to detect if it has been clicked already so that if it has and it is on frame 10, if the user clicks it again, it won't go to and play at frame 2.

Simply, if the user has clicked the box once, I don't want them to be able to click again.

How do I do this????

I have tried to use this: on frame 1 of the MC, on the timeline, I put "click = true;" in actionscript. and on frame 10 in the timeline i put "click = flase;". In the movie clip i put "if (box.click = true) { gotoAndPlay(2); }else{ gotoAndStop(1); }

I thought that using that would make what i want possible, but it doesn't.


Please Help me!

View Replies !    View Related
Movieclip Covering A Button... How To Click The Button?
I'm using vCam in a project right now, and I'd like to be able to have clickable hotspots on the screen... but the problem is that the vcam movieclip sits on top of the buttons and therefore makes them unclickable.

How do you deal with this in as3? Is there a way to make sure you only get the hand cursor when you're over the button even though the vCam clip is in the way? I've attached a small file demonstrating the issue.

View Replies !    View Related
Cannot Call Button Function Within Another Event Function
Hopefully someone can help me out with this one. I'm importing XML in order to draw images into an animated scrollbar, and would like to nest a button function within the function urlLoaded as listed below:

import caurina.transitions.*;

var urlCall:URLRequest = new URLRequest("pics/hotel_dreams/hotel_dreams.xml");
var urlLoader:URLLoader = new URLLoader();
var xml:XML;
var xmlList:XMLList;
urlLoader.load(urlCall);
urlLoader.addEventListener(Event.COMPLETE,urlLoade d);

var arrayThumb:Array = new Array();
var photoContainer:Sprite = new Sprite();
addChild(photoContainer);
photoContainer.mask=thumb_holder;


function urlLoaded(event:Event):void {


xml = XML(event.target.data);
xmlList = xml.children();
trace(xmlList.length())
for (var i:int=0; i<xmlList.length(); i++) {
var thumb:Thumbnail = new Thumbnail(xmlList[i].url);
arrayThumb.push(thumb);
arrayThumb[i].y = 67.5;
arrayThumb[i].x = xml.children().x_position[i];
photoContainer.addChild(thumb);
arrayThumb[i].gallery = xml.children().gallery[i];

trace(arrayThumb[i].gallery);


}


}

my hope is to create a button that looks something similar to the following in order to execute an if then statement within the function controlling the visibility of images from the XML based on their gallery property value.

btn_gallery_2.addEventListener(MouseEvent.CLICK, open_gallery_2);
function open_gallery_2(event:MouseEvent) {

if (arrayThumb[i].gallery == 2) {
arrayThumb[i].visible = true
}

}

I have been trying to nest within the urlLoaded function to no avail. By running trace statements I can see that [i] is inaccessible when nested within another function within urlLoaded and when completely outside of the urlLoaded function.

The Thumbnail class referenced is in an .as file that looks like this:

package {
import flash.display.Sprite;
import flash.display.Loader;
import flash.net.URLRequest;

public class Thumbnail extends Sprite {

private var url:String;
private var loader:Loader;
private var urlRequest:URLRequest;
public var gallery:Number

function Thumbnail(source:String):void {
gallery = 0
url=source;
drawLoader();

}

{
private function drawLoader():void {

urlRequest=new URLRequest(url);
loader=new Loader ;
loader.mouseEnabled=false;
loader.load(urlRequest);
loader.x=-0;
loader.y=-68
;
addChild(loader);

}}}}

I have the suspicion that I am missing something very basic. If anyone out there might be able to give me some insight, then I would be appreciative.

thanks very much

View Replies !    View Related
Targeting Button When You Click The Button
Hi there,

I have an interesting little problem... I have a number of thumbnail buttons that I am loading images into and I want to be able to load that image larger when you click on it, here is the code so far...


Code:
for(var i =1; i < imageTotal; i++){
var thumbLoader =new Loader();
thumbLoader.load(new URLRequest("images/portfolio/thumbs/" + i + ".jpg"));
portfolioSectionMC["thumbMC" + i].imageHolderMC.addChild(thumbLoader);

portfolioSectionMC["thumbMC" + i].imageNo = i;

portfolioSectionMC["thumbMC" + i].thumbBU.addEventListener(MouseEvent.MOUSE_DOWN, thumbButton);
function thumbButton(event:MouseEvent):void {

}
}
In as2 I would have simply put _this._parent.imageNo = imageNo to get the number of the button however the new way that as3 asigns buttons means that I cannot use this in a button as it is a function separate from the button. Any ideas how I could go about getting the imageNo variable from within the button without coding every single button separately?

Thanks,

Bob

View Replies !    View Related
2nd Click Of A Button
Is there a way to assign an action to a button so that a particular action will take place the second time the button is clicked, but not the first?

Let say for example there is a telephone keypad on the screen (Stop action in frame 1). I want someone to push (click)the numbers 9 1 1. When the 1 is clicked the second time, the action takes the user to the next frame.

How do I go about doing this?

Thanks

View Replies !    View Related
I Can't Click My Button
Hi,


i have a button on my stage that is placed under a input text field. for various reasons i cannot physically place the button on a higher level or layer than the field. Does anyone have any ideas how i can make this clickable still???

Thanks...

View Replies !    View Related
Copyright © 2005-08 www.BigResource.com, All rights reserved