OnRollOut, OnRollOver and OnPress
Hi guys
I have been searching for the answer to this for ages and would greatly appreciate anybodies help.
I have a button that I basically want to give the action:
on (press) {
gotoAndPlay (3) ;
on(rollOver) {
gotoAndPlay (2) ;
on (rollOut) {
gotoAndPlay (1) ;
So basically when the user rolls over the button I want to show frame 2. When they roll off it I want it to show frame 1. And when they click the button I want it to show frame 3.
But what happens with the above code is when I roll over the button it goes to frame 2 then stops and frame 3. Then when I roll off it, it stays at frame 3.
If anybody can tell me what I need to do to make it work right I'd greatly appreciate it.
Cheers,
use:
on (press) {
this.pressed=true;
gotoAndStop(3) ;
on(rollOver) {
gotoAndStop (2) ;
on (rollOut) {
if(!this.pressed){
gotoAndStop (1) ;
} else {
gotoAndStop(3);
// and if another button is clicked and you want to direct a previously pressed button away from frame 3, you should change your approach and remove all code from objects. actually, you should do that anyway.
p.s. please mark this thread as answered, if you can
Similar Messages
-
Try this blur tween, onRollOver and RollOut..
Hello,
I ff you roll over the first button (red one) ..it will
increase in size and decrease in Size when roll out.
This goes well, but when you do it to soon, the startsize is
to big. Is there a way to get the value of the current
size when use the RollOut function?
Also the blur value when tracing this does not work very well
on the rollout. Sometimes it jumps from 10 to 0 ..
it should work from 10, to 9, 8, 7,6,5,4,3,2,1,0 ..
Can someone take a look at this code? I am not sure if i am
doing it the right way.
If you place 3 movieclips on your stage and call there
instance names:
rood_mc
oranje_m;
groen_mc
and copy this code :
import flash.filters.BlurFilter;
import mx.transitions.Tween;
import mx.transitions.easing.*;
var sizeknop:Number = 200;
var sizeknopstart:Number = 100;
var speedknop:Number = 2; // 30 frames per seconden.
var seconden:Boolean = true; // flase = gebruik frames
p/seconden
rood_mc.onRollOver = function() {
var tweenSizeY:Object = new Tween(rood_mc, "_yscale",
Strong.easeOut, sizeknopstart, sizeknop, speedknop, seconden);
var tweenSizeX:Object = new Tween(rood_mc, "_xscale",
Strong.easeOut, sizeknopstart, sizeknop, speedknop, seconden);
var tweenBlur:Object = new Tween(oranje_mc, "blur",
Strong.easeOut, 0, 10, 2, true);
tweenSizeX.onMotionChanged = function() {
blurwaarde = Math.round(oranje_mc.blur);
//trace(blurwaarde);
oranje_mc.filters = [new BlurFilter(blurwaarde, blurwaarde,
1)];
blauw_mc.filters = [new BlurFilter(blurwaarde, blurwaarde,
1)];
rood_mc.onRollOut = function() {
var tweenSizeY:Object = new Tween(rood_mc, "_yscale",
Strong.easeOut, sizeknop, sizeknopstart, speedknop, seconden);
var tweenSizeX:Object = new Tween(rood_mc, "_xscale",
Strong.easeOut, sizeknop, sizeknopstart, speedknop, seconden);
var tweenBlur:Object = new Tween(oranje_mc, "blur",
Strong.easeOut, 10, 0, 2, true);
tweenSizeX.onMotionChanged = function() {
blurwaarde = Math.round(oranje_mc.blur);
trace(blurwaarde);
oranje_mc.filters = [new BlurFilter(blurwaarde, blurwaarde,
1)];
blauw_mc.filters = [new BlurFilter(blurwaarde, blurwaarde,
1)];Thanks Sulemaan !
It's working! -
How can I create a generic listener?
So I 'm coding a Flash animation where there are two streams
of MovieClip objects scrolling both right to left on the top
portion of the Stage and left to right on the bottom portion of the
Stage. Each object is attached the Stage using attachMovie() and
after they cross the Stage they are removed. I want to be able to
attach some kind of listener to each object so they are can respond
to onRollOver() and onPress(). Does anyone have any tips?
Thanks,
Mikeyou can add one listener to many movieclips, but that can't
be used to define actions related to a movieclip that doesn't exist
when the listener is created. you'd have to recreate the listener
each time a movieclip is created/attached.
why not define those handlers for movieclips as they are
attached? -
Hello guys. I am new to Flash and would like some help from you guys. I would really appreciate it. Thanks,
So, here is the problem.
My friend has created a flash navigation bar for me. Since I can not add links here, huhtea is the address with com.
Now, I would like to add text links and onPress (getURL) for images in my submenu.
I have tried all kinds of things. I have watched numerous youtube clips on this matter.
After adding onPress codes in Actionscript 1.0 & 2.0 and checking them, everything was fine. But if I publish it, the image does not go to the URL.
This goes for the text link as well. After highlighting the text and adding http address in the properties, everything is fine. But again, published file does not lead me to the URL.
Can someone please help me out?
Thanks,If I look at the page code of the page you say to look at, I'd say your problem lies there, and possibly in the flash file as well. I see one url in that page that targets a local drive, which is not going to work...
url=Link[file\:/C\:/Program%20Files%20(x86)/Yahoo%20SiteBuilder/sites/Imex/ready.html
So it is possible you have other such links in your Flash file. I am not able to find the swf's in that page code, and seeing as how it indicates something in the way of Yahoo Site Builder being used, there could be any number of problems in trying to go that route.
What does the getURL code look like in your Flash file? If you are using relative links, that might be related to the problem, especially if the Flash file is in a different folder than the web page. -
Click and something appears on the screen
what i am trying to do is this, have people click on a link
on my website, then have something appear when they click on it. to
give you an example, if you go to
atticus clothing's
website and look under where it says updated news, or something
like that, in the top left corner. you click on a date, and the
info for that date appears right next to where you clicked. i don't
even know how to go about doing that.
any help is greatly appreciated.dont know if this wud help..but try it.....
make the movie that wud appear when u press the button....and
position it where u want it to appear when the button is
pressed....
then add this code in the actions frame.....
nameofmovieclip_mc._visible = false;
nameofbutton_btn.onPressed = function() {
nameofmovieclip_mc._visible = true;
this code will do what u want but once the button is
pressed...pressed as in hold.....adding this action...wud make the
movie clip disappear...
nameofbutton_btn.onRelease = function() {
nameofmovieclip_mc._visible = false;
or you can just make variation out of this....by plying with
the button functions.....onRollOver, onRollOut..and so
on.... -
I have an OOP problem. I'm new to OOP so it can be very easy
or impossible. Either way - I don't know where to look for the
answer.
I have linked a class to a number of movieclips that i have
on stage. The movieclips are clickable (buttons) and I want all
buttons to be changed when I click one of them. E.g i want all to
be dimmed if one is clicked. My problem is that i don't know how to
call all my instaces of a class from one, or if it is possible!
Do I make any sense? :)
/EOk, thank you for the anwer!
So there is no way of a class to know how many instances that
are vreated from it without saving references in an array?
Couldn't I then use a static property to keep track of each
button reference (in this case)? And have a method that itterates
through the array?
I dont really understand what you mean with manager class. Is
that proper lingo? (so I can look it up).
Do you mean that i should have a superclass?
My real scenario is that I have a class linked to a couple of
buttons. The class has onRollOver, onRollOut and onPress methods.
Then I want to have an onDim method that is called when a button is
clicked. I want this onDim function to be called on each button.
(The clikced and the other ones). The reaseon is that I want to
deactivate all buttons (MovieClips with button handlers) with:
this.useHandCursor=false;
This because of a pop-up appears over all the buttons. -
Asfunction, cursor states, and moviclips...oh my
Hello all. I've ran into a bit of a snag and I'm thinking the
obvious is sitting right in front of me...
I have a dynamic movieclip that is created to serve as a
container for a dynamically created textfield. The textfield has
html text. Within that html text is an asfunction to call a method.
Code is posted below:
MovieClip(this.createEmptyMovieClip("textOneContainer_mc",
this.getNextHighestDepth());
TextField(textOneContainer_mc.createTextField("textOneField",
textOneContainer_mc.getNextHighestDepth(), 10, 10, 300, 30));
// Method triggered from asfunction call from html text
textOneContainer_mc.launchGlossary = function(arg){
trace("Launch Glossary Method Hit, Glossary Word: "+arg);
textOneContainer_mc. textOneField.html = true;
textOneContainer_mc. textOneField.htmlText = htmlString_str;
Now the issues are:
1. if applied, textOneContainer_mc onRollOver, onRollOut,
onRelease, and etc seem to not allow the asfunction to be called
2. i'm using custom cursors, which work fine...however, the
system hand cursor appears over the word I have linked via
asfunction. I've tried using the useHandCursor = false MovieClip
property, but it still appears.
I hope this makes sense, i'm a little dumbfounded on this
one. The last thing I want to do is to do a split on the html text
and put each word in it's own MovieClip just to achieve what the
asfunction already does.// Store Text and Audio Data From XML
var pagetext_xmlnodeOne:XMLNode =
matchSiblingNode(_parent.currentPage_xmlnode.firstChild,"instructionalTextOne");
var pagetext_xmlnodeTwo:XMLNode =
matchSiblingNode(_parent.currentPage_xmlnode.firstChild,"instructionalTextTwo");
var swf_xmlnode:XMLNode =
matchSiblingNode(_parent.currentPage_xmlnode.firstChild,"externalSwfFile");
var swfLocation:String = swf_xmlnode.attributes.swfFilePath;
var textOneAudio:String =
pagetext_xmlnodeOne.attributes.audioPath;
var textTwoAudio:String =
pagetext_xmlnodeTwo.attributes.audioPath;
var titleText:String =
_parent.currentPage_xmlnode.attributes.title;
var textOne_str:String =
pagetext_xmlnodeOne.firstChild.nodeValue;
var textTwo_str:String =
pagetext_xmlnodeTwo.firstChild.nodeValue;
trace("///// Title Text: "+titleText+"
//Loads SWF File
function loadSWF(externalSwfLocation:String){
var swfFile:Boolean = false;
//Object to Load SWF File
var mcLoader:MovieClipLoader = new MovieClipLoader();
var mclListener:Object = new Object();
if (externalSwfLocation != undefined){
if (externalSwfLocation.indexOf(".swf") > 0){
swfFile = true;
trace(".SWF Path: "+externalSwfLocation+" Target Clip:
"+mediaSWF_mc);
mcLoader.loadClip(externalSwfLocation,mediaSWF_mc);
image_mc = mediaSWF_mc;
} else {
//In the Event There is No SWF File, loadText Method Called
trace("No SWF File to Load, loadText Method Being Called");
loadText(textOne_str,textTwo_str,textOneAudio,textTwoAudio);
mcLoader.addListener(mclListener);
mclListener.onLoadComplete = function(){
trace(".swf Loaded Successfully");
trace("loadText Method Being Called");
loadText(textOne_str,textTwo_str,textOneAudio,textTwoAudio);
mclListener.onLoadInit = function(target_mc:MovieClip){
//Adjust SWF
var pictH:Number = target_mc._height;
var pictW:Number = target_mc._width;
var pictX:Number = target_mc._x;
var pictY:Number = target_mc._y;
if (swfFile){
pictH = Number(swf_xmlnode.attributes.swfHeight);
pictW = Number(swf_xmlnode.attributes.swfWidth);
if(swf_xmlnode.attributes.swfX!=undefined){
pictX = Number(swf_xmlnode.attributes.swfX);
} else { pictX = 0 };
if(swf_xmlnode.attributes.swfY!=undefined){
pictY = Number(swf_xmlnode.attributes.swfY);
} else { pictY = 0 };
//Adjust to New SWF Size and _x/_y Cooordinates
mediaSWF_mc._width = pictW;
mediaSWF_mc._height = pictH
mediaSWF_mc._x = pictX;
mediaSWF_mc._y = pictY;
mediaSWF_mc._alpha = 0;
// loadText Method
// Creates Movieclips to Store Textfield Data
function loadText(textOne_str:String, textTwo_str:String,
textOneAudio:String,textTwoAudio:String){
if(pagetext_xmlnodeOne.attributes._y!=undefined){
var txtOneY_num:Number = pagetext_xmlnodeOne.attributes._y;
} else {
var txtOneY_num:Number = 0;
var txtOneBlock:String =
pagetext_xmlnodeOne.attributes.textBlock;
if(textOne_str!=undefined){
var vlaInstrOneTxt_mc =
MovieClip(this.createEmptyMovieClip("vlaInstrOneTxt_mc",
this.getNextHighestDepth()));
var vlaInstrOne_txt =
TextField(vlaInstrOneTxt_mc.createTextField("vlaInstrOne_txt",
vlaInstrOneTxt_mc.getNextHighestDepth(), 8, txtOneY_num, 0, 0));
var vlaInstrOneFld = vlaInstrOneTxt_mc.vlaInstrOne_txt;
vlaInstrOneFld.autoSize = "left";
vlaInstrOneFld.embedFonts = true;
vlaInstrOneFld.selectable = false;
vlaInstrOneFld.multiline = true;
vlaInstrOneFld.border = false;
vlaInstrOneFld.html = true;
vlaInstrOneFld.htmlText = textOne_str;
vlaInstrOneTxt_mc.enabled = false;
vlaInstrOneTxt_mc._alpha = 0;
vlaInstrOneTxt_mc.launchGlossary = function(arg){
trace ("You clicked me!Argument was "+arg);
if(pagetext_xmlnodeTwo.attributes._y!=undefined){
var txtTwoY_num:Number = pagetext_xmlnodeTwo.attributes._y;
} else {
var txtTwoY_num:Number = 0;
var txtOneBlock:String =
pagetext_xmlnodeOne.attributes.textBlock;
if(textTwo_str!=undefined){
var vlaInstrTwoTxt_mc =
MovieClip(this.createEmptyMovieClip("vlaInstrTwoTxt_mc",
this.getNextHighestDepth()));
var vlaInstrTwo_txt =
TextField(vlaInstrTwoTxt_mc.createTextField("vlaInstrTwo_txt",
vlaInstrTwoTxt_mc.getNextHighestDepth(), 8, txtTwoY_num, 0, 0));
var vlaInstrTwoFld = vlaInstrTwoTxt_mc.vlaInstrTwo_txt;
vlaInstrTwoFld.autoSize = "left";
vlaInstrTwoFld.embedFonts = true;
vlaInstrTwoFld.selectable = false;
vlaInstrTwoFld.multiline = true;
vlaInstrTwoFld.border = false;
vlaInstrTwoFld.html = true;
vlaInstrTwoFld.htmlText = textTwo_str;
vlaInstrTwoTxt_mc.enabled = false;
vlaInstrTwoTxt_mc._alpha = 0;
var vlaInstrText_fmt:TextFormat = new TextFormat();
vlaInstrText_fmt.font = "VAGRoundedRegular";
vlaInstrOneFld.setTextFormat(vlaInstrText_fmt);
vlaInstrTwoFld.setTextFormat(vlaInstrText_fmt);
// Make Sure Text Stays Within Bounds
if(pagetext_xmlnodeOne.attributes.textBlock == "Left"){
if(vlaInstrOneFld._width > 375){
vlaInstrOneFld.wordWrap = true;
vlaInstrOneFld._width = 375;
} else {
if(vlaInstrOneFld._width > 670){
vlaInstrOneFld.wordWrap = true;
vlaInstrOneFld._width = 670;
if(pagetext_xmlnodeTwo.attributes.textBlock == "Left"){
if(vlaInstrTwoFld._width > 375){
vlaInstrTwoFld.wordWrap = true;
vlaInstrTwoFld._width = 375;
} else {
if(vlaInstrTwoFld._width > 670){
vlaInstrTwoFld.wordWrap = true;
vlaInstrTwoFld._width = 670;
// Call Transitions Clip for TextFields
trace("All Textfield Clips Loaded, Transitions and Audio
Will Now Take Place");
transitionInFirstTxtClip();
// Apply Transitions Clip to First TextField
function transitionInFirstTxtClip(){
if(textOne_str!=undefined){
fadeIn(vlaInstrOneTxt_mc, 7, this, "readFirstAudioClip");
} else {
trace("No Instructional Text 1 Found, calling
readFirstAudioClip");
readFirstAudioClip();
// Play Audio Related to First TextField
function readFirstAudioClip(){
if(textOneAudio!=undefined){
playSFX(textOneAudio, this, "nextClipTransition");
vlaInstrOneTxt_mc.enabled = true;
} else {
trace("No Instructional Text 1 Audio File Found, calling
nextClipTransition");
nextClipTransition();
// Apply Transtions Clip to Second TextField
function nextClipTransition(){
if(textTwo_str!=undefined){
fadeIn(vlaInstrTwoTxt_mc, 7, this, "readSecondAudioClip");
} else {
trace("No Instructional Text 2 Found, calling
readSecondAudioClip");
readSecondAudioClip();
/// Play Audio Related to Second TextField
function readSecondAudioClip(){
if(textTwoAudio!=undefined){
playSFX(textTwoAudio, this, "displaySwfFile");
vlaInstrTwoTxt_mc.enabled = true;
} else {
trace("No Instructional Text 2 Audio File Found, calling
displaySwfFile");
displaySwfFile();
// Display SWF File
function displaySwfFile(){
if(swfLocation!=undefined){
fadeIn(mediaSWF_mc, 1, this, "applyCursorStates");
} else {
trace("No SWF File Found, calling applyCursorStates");
//applyCursorStates();
function applyCursorStates(){
// Apply MovieClip Methods to TextField
vlaInstrOneTxt_mc.onRollOver = vlaInstrTwoTxt_mc.onRollOver
=function(){
cursorRollOverAudio();
vlaInstrOneTxt_mc.onRollOut = vlaInstrTwoTxt_mc.onRollOut
=function(){
cursorRollOutAudio();
vlaInstrOneTxt_mc.onRelease = function(){
cursorRollOverAudio();
playSFX(textOneAudio);
vlaInstrTwoTxt_mc.onRelease = function(){
cursorRollOverAudio();
playSFX(textTwoAudio);
var __soundFX:Sound = new Sound();
var audioFlag:Boolean = false;
function playSFX(audioClip:String, targ:MovieClip,
onComplete:String):Void {
__soundFX.onLoad = function(success:Boolean){
if(success){
if(!audioFlag){
audioFlag = true;
__soundFX.start();
trace("Audio Clip: "+audioClip+" is Now Playing");
} else {
__soundFX.stop();
audioFlag = false;
trace("Audio Clip Stopped");
var args = arguments.slice(3, arguments.length);
__soundFX.onSoundComplete = function() {
audioFlag = false;
trace("Audio Clip Completed");
if(onComplete!=undefined){
trace("Audio "+audioClip+" Completed, Calling onComplete
Method: "+onComplete);
targ[onComplete](args);
} else {
trace("Audio Completed, no onComplete Method to Call");
__soundFX.loadSound(audioClip,false);
// Stop Audio Method
function stopSFX():Void {
trace("__PLAYER: AUDIO CLIP STOPPED");
__soundFX.stop();
loadSWF(swfLocation); -
I have assigned the onRollOver and onRollOut event handlers
for a movie clip to enact an alpha animation function on an
interval, and it works, but only once.
http://www.kustedg.com/lincoln.swf> mcEnterSite.onRollOver = function():Void {
> var nInterval:Number = setInterval(fadeIn, 10);
> };
> mcEnterSite.onRollOut = function():Void {
> var nInterval:Number = setInterval(fadeOut, 10);
>
> };
>
> function fadeIn():Void {
> mcWelcome._alpha++;
> updateAfterEvent();
> };
> function fadeOut():Void {
> mcWelcome._alpha--;
> updateAfterEvent();
> };
>
Nick is right, you need to clear the interval function.
Basically a setInterval keeps running until the interval-id
is cleared. So,
you would probably be best off using a variable that is in
the scope of the
mcEnterSite... for instance.
mcEnterSite.intervalId = 0;
mcEnterSite.onRollOver = function():Void {
clearInterval(mcEnterSite.intervalId);
mcEnterSite.intervalId = setInterval(fadeIn, 10);
mcEnterSite.onRollOut = function():Void {
clearInterval(mcEnterSite.intervalId);
mcEnterSite.intervalId = setInterval(fadeOut, 10);
function fadeIn():Void {
mcWelcome._alpha ++;
updateAfterEvent();
function fadeOut():Void {
mvWelcome._alpha --;
updateAfterEvent(); -
Hello there
I've made SWF in which, when the user puts their mouse over
the movie clip, a rectangle will apear. Now, what I want is the
following: as the recangle emerges, for a sound effect to be played
at the same time - bearing in mind for it only to happen when the
mouse is on the SWF.
To put it basically, I want a sound effect to play only on
RollOver. How can this be accomplished?
All the best,
Kristopher (UK).You need to dynamically load the sound. Here's how to do it
with ActionScript 2 (sorry, I haven't got CS3, so perhaps someone
else can update it for ActionScript 3):
1) Import the sound into the library
2) In the library, right-click on the sound and choose
Linkage
3) Make sure "Export for ActionScript" and "Export in First
Frame" are ticked.
4) Give it an identifier name, such as mySound
5) DO NOT put the sound on the timeline.
6) On the main timeline, hopefully you have a separate layer
just for ActionScript. If not, create one.
7) Highlight frame 1 of the Actions layer on your timeline,
then add this script in the Actions panel:
(for this example, I'm calling your movie clip myMC)
var rollOverSound:Sound = new Sound();
rollOverSound.attachSound("mySound");
myMC.onRollOver = function(){
rollOverSound.start(0,1);
myMC.onRollOut = function(){
rollOverSound.stop();
(since you presumably already have onRollOver and onRollOut
functions for your movie clip, just add the relevant lines to your
existing functions:
rollOverSound.start(0,1);
rollOverSound.stop(); -
Using Click Boxes and Rollover Slidelets on same frame issue
Hi all,
We are building a series of practice simulations, where the learner performs X steps to complete a software task. Each frame of the sim begins with a Task box that displays for a moment, then disappears. If the learner cannot remember the task, there is a Task button that has a rollover slidelet assigned to it, that when rolled over, displays the initial Task box. This all works fine. However, if the learner clicks on the rollover slidelet, rather than rolling over it, the click box on the page sees that as an attempt, and displays the Incorrect feedback box.
I have set the rollover slidelet properties to no action for both Onclick and OnRollover, and have placed the rollover slidelet to be on the top layer of the frame, but I cannot prevent the Click box from seeing when the learner clicks on the Rollover slidelet field.
Any thoughts?
Thanks,
Steve RJust to answer to something in your last sentence: even if each slide has a unique text, you could insert a user variable in the rollover text on the Master slide, and populate that variable on each slide with an On Enter action (command Assign). In this blog post I used such a work flow:
http://blog.lilybiri.com/beat-the-system-save-time-creating-advanced-a
Lilybiri -
Custom MovieClip class and loadMovie
Hi, I am trying to create a custom MovieClip class with
loadMovie, but it doesn't work.
I created a movie clip symbol and action script linked to it,
such as:
class CustomMovieClip extends MovieClip { ... custom
functions to define the behavior, onPress, onMouseMove, etc ... }
It works all fine until I call loadMovie on an instance,
trying to change the shape.
As I searched, I figured loadMovie can mess you up if you do
somthing like mc.onPress = .... but
is this the case for a custom class? Hope not.
Any help???Solved the issue myself. I write it here so other people can
find it.
Basically, you can't do loadMovie directly to CustomMovieClip
class instance.
It will mess up all the methods you have defined in the
class.
Workaround is to do loadMovie to a variable in the class.
Complete working example is here:
1. Create a project MCTest.flp
2. Prepare Movie1.swf (a simple shape)
3. Create a Flash document MCTest.fla
4. Create a ActionScript file CustomMovieClip.as:
class CustomMovieClip extends MovieClip {
function onPress() {
trace("onPress");
6. Create a symbol CustomMovieClipContent:
Behavior: Movie Clip
Draw nothing.
5. Create a symbol CustomMovieClip:
Behavior: Movie Clip
Identifier: CustomMovieClip
AS 2.0 Class: CustomMovieClip
Export for ActionScript: Yes
Export in first frame: Yes
Open editor and drag&drop CustomMovieClipContent, name
it 'contents'
6. Edit ActionScript in MCTest.fla>Scene 1>Layer
1>1st Frame
attachMovie("CustomMovieClip", "customMovieClip1", 0,
{_x:100, _y:100});
customMovieClip1.contents.loadMovie("Movie1.swf");
7. Preview and you see two movie clips.
Click on the object, and "onPress" is printed in the output. -
Components disrupting MovieClip events.
I am writing a program (in Flash 8 with AS 2.0) to run
through chess games loaded from PGN files.
I need buttons that do the following: Go to Next Move, Go to
Previous Move.
I have created a couple of MovieClip buttons with
onRollOver/onRollOut and onPress event functions
(The RollOver and RollOut events are used just to
apply/remove filters to highlight/dehighlight the buttons)
Simple. Works fine.
BUT I then add a ComboBox component to the stage.....
The buttons work fine UNTIL I CLICK ON THE COMBOBOX.
After that, if I roll over a button I get a 'RollOver' event
(o.k.)
I press the button and I get a 'Press' event (o.k.)
immediately followed by a 'RollOut' event (NOT o.k.!)
Now, without moving the cursor off the button, every
subsequent press causes a 'RollOver' immediately followed by a
'RollOut' event (but NO 'Press' event).
I do not get another 'Press' event until the cursor has moved
off the button and then over it again, when I get a repeat of the
above (i.e. Press+RollOut after first press then RollOver+RollOut
after subsequent presses.
I can reproduce the problem as follows:
1. Create a new Flash Document
2. Draw a shape on the stage and convert it to a MovieClip
named 'btn1'.
3. Place a ComboBox named 'cbox1' on the stage.
4. Add the following script to frame 1...
btn1.onRollOver = function() { trace( "RollOver" ); }
btn1.onRollOut = function() { trace( "RollOut" ); }
btn1.onPress = function() { trace( "Pressed" ); }
That's all! (The ComboBox does nothing and has no event
listener assigned to it.)
The button works fine UNTIL THE COMBOBOX IS CLICKED.
After that you get the situation described above!
I'd really appreciate if anyone can
(a) tell me if they can reproduce the problem or, better
still,
(b) let me know what's going on and how I can solve this.
Cheers.
(p.s. it's not just the ComboBox component. I've had the same
problem with e.g. an Input TextField)Thanks for trying.
This one's driving me mad.
The only work-around I've come up with is to place the
ComboBox in a separate MovieClip, attach it only when it is needed,
and then remove the MovieClip, which is a real pain. -
Problems Overriding setInterval with Button onRelease
Hi.
I'm successfully jumping between playing Frame 1 and Frame 2
using the functions below and setIntervals ...
( The following code is in Frame 1 main timeline ... )
stop();
/ / this advances to the next frame
var myInterval:Number;
function proceed() {
nextFrame();
clearInterval(myInterval);
myInterval = setInterval(proceed,15000);
// The code below is in Frame 2 of the main timeline
stop();
// the following function goes back a frame
var myInterval:Number;
function receed() {
clearInterval(myInterval);
prevFrame();
myInterval = setInterval(receed,9000);
Everything gets all jacked up when I try and add a button to
escape the flipping between Frame 1 and 2 and jump to Frame 5. My
button is in frame 1. The following script is on Frame 1 of main
Timeline and instead of going to Frame 5 when the button is pressed
it just goes to the Next Frame (not overriding setInterval??)
//FLASH GLOSSY BUTTON
//designed and developed by [email protected]
import mx.transitions.Tween;
import mx.transitions.easing.*;
//functions used for the event handlers
function over(){
var myTween:Tween = new
Tween(this.btn_mask,"_alpha",Strong.easeOut,this.btn_mask._alpha,50,2,true);
function out(){
var myTween:Tween = new
Tween(this.btn_mask,"_alpha",Strong.easeOut,this.btn_mask._alpha,0,2,true);
function press(){
this._y +=3;
this._x +=3;
// Want to go to Frame 5 on release of button ...
function release(){
this._y -=3;
this._x -=3;
clearInterval(myInterval);
gotoAndPlay("5");
function releaseoutside(){
var myTween:Tween = new
Tween(this.btn_mask,"_alpha",Strong.easeOut,this.btn_mask._alpha,0,2,true);
this._y -=3;
this._x -=3;
//button1 events
btn1.onRollOver = over;
btn1.onRollOut = out;
btn1.onPress = press;
btn1.onRelease = release;
btn1.onReleaseOutside = releaseoutside;
Any suggestions?
Sincerely,
Paul Crossunless your frame is labeled with the string 5, you should
use:
gotoAndStop(5).
and if it is labeled with the string 5 you should change it.
it's problematic to use flash names that start with a
number. -
Could someone help me "translate" as2 to as3
Hi, this is my first post i am sorry if this is in the wrong
cattegory
Here is the problem. i basically am quite familiar with as2,
but im not sure how to convert this into as3. Here are the problems
AS2:
stop();
AS2 Version:
this.x_mc.onRelease = function(){
gotoAndPlay ("x");
AS2:
this.x_mc.onPress= function(){
gotoAndPlay ("x");
AS2:
this.x_mc.onRollOver= function(){
gotoAndPlay ("x");
AS2:
this.x_mc.onRollOut = function(){
gotoAndPlay ("x");
Hopefully someone could provide me with the Actionscript 3
versions of these please. Your help is greatly appreciated, its for
a Portfolio.under 3 we use the event listener model, so you have to set
up mouse handlers like this:
function methodname(e:MouseEvent):void {
//actions
instancename.addEventListener(MouseEvent.CLICK, methodname);
set up one event listener and one corresponding handler
method for each type of mouse event:
MouseEvent.ROLL_OVER = onRollOver
MouseEvent.ROLL_OUT = onRollOut
MouseEvent.MOUSE_DOWN = onPress
MouseEvent.MOUSE_UP = onRelease
stop() and gotoAndPlay() remain the same as under 2
but there is an additional advantage, you can set up a
'single' event handler for multiple buttons, and then you can use
the properties of the event Object (ie. 'e' in the above example)
to access the instance that sent the event notification. for
instance, say you wanted to change the alpha property of the button
on rollover you can target the instance using:
function methodname(e:MouseEvent):void {
e.target.alpha = 0.5;
} -
How To Make Text Disappear When Mouse is On a Button?
Hello, I'm completely new to Flash and well I need some help. I created a page that has static text in the center.
The page has buttons on side and when I rollover a button text appears, but the problem is that when I rollover a button, the static text in the center is there and I want to hide it as I can't read anything because the texts are overlapped.
How do I make the text in the center disappear/hide when I rollover a button and how do I make it reappear when the the mouse is off the button?
I hope what I am explaining makes sense.You can assign onRollOver and onRollOut code to the buttons to make the text dispappear, but you'll need to make the text a movieclip with an instance name that you can use to target it to turn it invisible. In the simple example below, the button has an instance name of "btn" and the text movieclip has an instance name of "text_mc"
btn.onRollOver = function(){
text_mc._visible = false;
btn.onRollOut = function(){
text_mc._visible = true;
Maybe you are looking for
-
How do i get more RAM in my iMac G4 800?
I'd like to expand the RAM on my iMac G4 800. I read a few discussions and am not quite sure what I can do. Here is what I have and what I want to do: Have: I have a iMac G4 800 with 512 in the J22 slot and 256 in the J20 slot. I am assuming the J20
-
Window on home page of iTunes doesn't display
On the iTunes home page, the window on top with the general categories GENRE, ARTIST and ALBUM does not display on top of the window with the optional chosen categories ( name, time. artist,track, composer etc.) How do I restore that window and why d
-
Pricing , freight conditon type, import procedure in pricing , taxes
I understood the pricing , but what with some exercises from where get this? How many conditon type will be used in MM ? <b>pricing , freight conditon type, import procedure in pricing , taxes</b> which conditon types used ? what make the settings in
-
Hello All, i created pdf form in livecycle.i am populating this pdf form and submit.when i am submiting form ,i will get the data in xfa(xml forms architecture).now i want to import this xml to indesign.when i importing this xml to indesign,it import
-
I want to learn about workflow any one can provide the guidence for me
i want to learn about workflow any one can provide the guidance for me