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




ROLL_OVER/ ROLL_OUT? Tween Problem?



Hi, i'm working on a gallery made from 8 squares which move when i roll over anyone of them, and on roll out it have to go back to its original position. I have a strange problem. It all began when i was trying to remove non smooth movement on roll out. It was becouse of the same time in tween on roll over and roll out but when user rolls out before the square will come to the final position, the square will have to move just ie. 10 pixels, in time, ie 2s. So its not smooth. So i calculate the time, so the movement would be smooth.Everything ok but when i changed the time its not working like it should.The code is simple. And i thought it should work. But when i roll out before end position, strange thing is happening. The square jumps to the end position. Anyone could help? :/
Code:
var moveTween:Tween;test_mc.addEventListener(MouseEvent.ROLL_OVER, in1);test_mc.addEventListener(MouseEvent.ROLL_OUT, out1);var time:Number = 2;function in1(e:MouseEvent):void {moveTween = new Tween(test_mc, "y", None.easeNone, test_mc.y, 260, time, true);moveTween.start();}function out1(e:MouseEvent):void {moveTween = new Tween(test_mc, "y", None.easeNone, test_mc.y, 222.5, ((time*(test_mc.y-222.5))/37.5), true);moveTween.start();}
As attachment i include example file with one square made this way i made it in the gallery. And with the same error.Btw. Strange thing is that the same error is when i use Caurina Tweener class...Well, sorry for my english:/



FlashKit > Flash Help > Actionscript 3.0
Posted on: 03-31-2008, 08:28 PM


View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread

Roll_over & Roll_out
Hello,

I have a navigation section that i want to fade in whenever the entire navsection has an active cursor over it. The navsection also includes a series of button_mc's that allow the user to navigate.

I have the Nav Section (instance named bg) animating properly, but whenever i move from 1 button to the next, it replays the alpha fade in.

Here's my code:


Code:
package {

import flash.display.*;
import flash.net.*;
import flash.events.*;
import flash.text.*;
import fl.transitions.Tween;
import fl.transitions.easing.*;
import fl.transitions.TweenEvent;


public class Sfgdc extends MovieClip {

public var sfStat:Boolean = false;


// create a new LocalConnection instance used to send
// calls to a LocalConnection instance in another movie
var outgoing_lc:LocalConnection = new LocalConnection();

public function Sfgdc() {



visitors.addEventListener(MouseEvent.ROLL_OVER, myOver);
visitors.addEventListener(MouseEvent.ROLL_OUT, myOff);
visitors.addEventListener(MouseEvent.CLICK, linkVisitors);
visitors.buttonMode = true;

online.addEventListener(MouseEvent.ROLL_OVER, myOver);
online.addEventListener(MouseEvent.ROLL_OUT, myOff);
online.addEventListener(MouseEvent.CLICK, linkOnline);
online.buttonMode = true;

help.addEventListener(MouseEvent.ROLL_OVER, myOver);
help.addEventListener(MouseEvent.ROLL_OUT, myOff);
help.addEventListener(MouseEvent.CLICK, linkHelp);
help.buttonMode = true;

textv.addEventListener(MouseEvent.ROLL_OVER, myOver);
textv.addEventListener(MouseEvent.ROLL_OUT, myOff);
textv.addEventListener(MouseEvent.CLICK, loadError);
textv.buttonMode = true;

}

function myTrace(event:MouseEvent):void {
trace("Home --> Click");
}
function myOver(event:MouseEvent):void {
var myTween:Tween = new Tween(bg.cover_mc, "alpha", Strong.easeIn, 0, 1, .15, true);
}
function myOff(event:MouseEvent):void {
var myTween:Tween = new Tween(bg.cover_mc, "alpha", Strong.easeIn, 1, 0, .15, true);
}

function linkVisitors(event:MouseEvent):void {
trace("Home --> linkVisitors");
outgoing_lc.send("Channel", "linkVisitors");
}
function linkOnline(event:MouseEvent):void {
trace("Home --> linkOnline");
outgoing_lc.send("Channel", "linkOnline");
}
function linkHelp(event:MouseEvent):void {
trace("Home --> linkHelp");
outgoing_lc.send("Channel", "linkHelp");
}
function linkTextv(event:MouseEvent):void {
trace("Home --> linkText");
outgoing_lc.send("Channel", "linkText");
}
function loadError(event:MouseEvent):void {
trace("Home --> Error");
outgoing_lc.send("Channel", "myError");
}
}
}


So in other words, when i go from 1 button to the next, it plays the ROLL_OUT and creates a flash effect. I'd prefer it that if it was within the main Nav Section it just stayed opaque.

ROLL_OVER, ROLL_OUT Looping
Hi all, I am working on a small file and am having a very frustrating time dealing with uncontrollable looping of a an actionscripted animation. Basically I have a series of pins and a series of labels. When you mouse over the pin a a label appears. If I set it up to only appear and not disappear it works fine. When I have the ROLL_OVER set to have the label appear and the ROLL_OUT set to have it disappear it loops like crazy. I can't figure out how to get it to do each operation once only and then reset itself once the mouse is off of the pin location. I have included my code for any pointers. I have tried calling button operations as functions and directly embedding it in the button script. I included my FLA as well. Thanks so much!


ActionScript Code:
stop();

import flash.events.MouseEvent;
import fl.transitions.Tween;
import fl.transitions.easing.*;

var pinMiamiTween:Tween = new Tween(pinMiami, "y", Strong.easeIn, -50, 151, 1, true);
var pinWeymouthTween:Tween = new Tween(pinWeymouth, "y", Strong.easeIn, -50, 106, 1.5, true);
var pinScotlandTween:Tween = new Tween(pinScotland, "y", Strong.easeIn, -50, 96, 1.25, true);

var i:int = 1;
sailMiami.alpha = 0;

pinMiami.addEventListener(MouseEvent.ROLL_OVER,miamiOver);
function miamiOver(MouseEvent) {
    if (i==1) {
        var pinMiamiTweenIn:Tween = new Tween(sailMiami, "x", Strong.easeOut, 200, 287, 1, true);
        var pinMiamiAlphaIn:Tween = new Tween(sailMiami, "alpha", Strong.easeOut, 0, 1, 3, true);
        i = 2;
    }
}

pinMiami.addEventListener(MouseEvent.ROLL_OUT,miamiOut);
function miamiOut(MouseEvent) {
    if (i==2) {
        var pinMiamiAlphaOut:Tween = new Tween(sailMiami, "alpha", Strong.easeOut, 1, 0, 1, true);
        i=1;
    }
}

ROLL_OVER & ROLL_OUT Problems
Hello everyone,
I'm new to AS 3.0 and I'm trying to make a set of simple thumbnails with roll over and roll out effect. When I roll over one thumbnail in a row it has to scale up, and other thumbnails have to move to left and right respectively, and when I roll out everything has to go to it's original place. Problem is, when I roll out from one thumbnail and roll over the other one directly, other thumbnails don't go to their original position. I'm using Tween class for thumbnail motion and I suppose that I need to use TweenEvent.MOTION_FINISH but don't know how exactly...

I attached .fla and .as file, so if anyone can help I would appreciate it!

Sorry for my English...

ROLL_OVER / ROLL_OUT Issue
I'm in the process of writing a 'elastic' tooltip class, where the tooltip follows the mouse with a small delay, making it look like an 'elastic' effect.

You can se an example here:
http://www.2xmedie.dk/develop/tooltip/
(Try to touch the tooltip with the mouse)

Sourcefiles here:
http://www.2xmedie.dk/develop/tooltip/source.rar

There's one issue though: When the mousepointer touches the tooltip it self, it causes an MouseEvent.ROLL_OUT on the target movieclip
This is causing the tooltip movieclip to 'flicker' since ROLL.OVER and ROLL.OUT are called constantly.

Can I some how, make sure, that the MouseEvent.ROLL_OUT is NOT called, when the mousepointer touches the tooltip movieclip?

I was looking at the method preventDefault() - but I'm not sure how to implement it.

Can someone please advice?

Roll_over & Roll_out Problems
Hello, I'm a newbie to the max. First off, I'm thankful that there are forums like this to help me out, it's very challenging but since I'm just beginning and I need all the help I can get.


Code:
stop();

btnGroup.addEventListener(MouseEvent.ROLL_OVER, target, false, 0, true);
btnGroup.addEventListener(MouseEvent.ROLL_OUT, out, false, 0, true);
btnGroup.mouseEnabled = true;
btnGroup.buttonMode = true;

var btnName:String = "";

function target(evt:MouseEvent):void {
btnName = evt.target.name;
gotoAndStop(btnName);
}
function out(evt:MouseEvent):void {
gotoAndPlay('first');
}
I've created all the movieclip buttons, and I put them all on stage to create a btnGroup. I'm not quite sure if they (btn1, btn2, etc.) have instance names EACH, so that might be a problem. The btnGroup is the one on stage, none of the btns are. The btnGroup has an instance name, and I've created empty frame labels. The problem, when I Test Movie, is that it just plays through the movie and does not stop anywhere, nor is there a "hand" to click any of the buttons. btn1 is the only one prepared for the roll over effect as of now, and thats why there are no more keyframes in the text1 layer.

When there is a rollover, I want static text to appear and the rollout is to start over, empty on stage.

ROLL_OVER, ROLL_OUT Problem
Any ideas what could cause a ROLL_OVER & ROLL_OUT displayObject repeat the listener functions over and over again, as if you were rolling out and in over and over again, but you're not?

There's no way I can show all the code, it's part of a large & complicated app.

ROLL_OVER, ROLL_OUT Interfering With Each Other?
I made a few movieclip buttons and when I when I roll my mouse over them they work just fine. They have an Over and an Out animation.

However, if I move my mouse around somewhat quickly over them all, the Over state for the button will stay on. They're only supposed to be active one at a time. I can move the pointer all around and the buttons won't always ROLL_OUT as I roll out and the ROLL_OVER state will stay on.

This isn't the first time I've had this happen. What can make these buttons work more efficiently when moving your mouse quickly over them?

Here is my AS3.


Actionscript Code:
but3.addEventListener(MouseEvent.ROLL_OVER, onButOver);but3.addEventListener(MouseEvent.ROLL_OUT, onButOut);but2.addEventListener(MouseEvent.ROLL_OVER, onButOver);but2.addEventListener(MouseEvent.ROLL_OUT, onButOut);but1.addEventListener(MouseEvent.ROLL_OVER, onButOver);but1.addEventListener(MouseEvent.ROLL_OUT, onButOut); 
function onButOver (event:MouseEvent) {    event.currentTarget.gotoAndPlay("over");}function onButOut (event:MouseEvent) {    event.currentTarget.gotoAndPlay("out");}

There has to be a way to do this. I have been to sites where I can roll over as fast as I want and the states will change. I can roll in and out of one button really quick and leave it in the ON state without it rolling out.

EDIT: This seems to only happen when the buttons are closer together. So picture 3 circles (100x100) about 15 pixels apart. Any help would be appreciated!!!

AS3 - Event Handling With ROLL_OVER And ROLL_OUT
Hello everyone,

I have been a bit confused about the right or proper way of implementing the following mouse events that i want to handle.

For example, lets say there are 3 seperate display objects on the Stage called btn1, btn2, and btn3.

All 3 buttons have ROLL_OVER and ROLL_OUT events. The current code works in a way that when a user rolls over a button then ROLL_OVER listener for that button is removed and ROLL_OUT listener is added for that button. And vice versa when roll out.

I want to be able to control when a user clicks on the Stage directly (MOUSE_DOWN) and then rolls over any button on the Stage while still MOUSE_DOWN and no roll over events should be triggered. I have implemented this simply by removing event listeners for each button when MOUSE_DOWN event is triggered on Stage. So far everything works fine.

When MOUSE_UP is triggred directly on the Stage i check whether e.target == e.currentTarget and if so then i know that the MOUSE_UP was directly on Stage and then I add all roll over listeners for the buttons on stage.

However, to add to all this, i want to be able now: when MOUSE_UP on any of the buttons from MOUSE_DOWN on the Stage to trigger that particular button's roll over event??????

So far i have not been able to figure out the right way how to do it. I have been able to accomplish the above with one button when i call the button's roll over functions when MOUSE_UP is triggered but that only works with one button.

When there are more that one button involved then i have to check to see which object has triggered the event and then dispatch the right event whether roll over or roll out.

I have been looking into creating a custom events dispatching class where i would dispatch events with paramaters specifying the status of the buttons etc, but i am confused which is the simples and most efficient way.

I am just a newbie with AS3.

Any help with this would be appreciated.

Thanks in advance.

janis

Is This Okay? If(btn.ROLL_OUT==true && Btn2.ROLL_OUT==true){
Is this okay?
Code:
a1.addEventListener(MouseEvent.MOUSE_OVER, mouseOutHandler);
a2.addEventListener(MouseEvent.MOUSE_OVER, mouseOutHandler);

function mouseOutHandler(event:MouseEvent):void {
if(a1.ROLL_OUT==true && a2.ROLL_OUT==true){
gotoAndStop(1);
}
}

Help With ROLL_OUT
I am working on an interactive map. When you roll over a dot on the map a slide moves into view. I've got this working great but when I add script for the roll out the whole movie just repeats over and over and the button doesn't work at all. I've pasted my code below.

Thanks for any help!

Jean









Attach Code

stop();

discoveryCenter.addEventListener(MouseEvent.ROLL_OVER, discoveryOver, false, 0, true);
function discoveryOver(evt:MouseEvent):void
{
gotoAndStop(3);
}

discoveryCenter.addEventListener(MouseEvent.ROLL_OUT, discoveryOut, false, 0, true);
function discoveryOut(evt:MouseEvent):void
{
gotoAndStop(4);
}

MC In Button Roll_out?
please if someone could help on this it would be much apprectiated. If you look at http://www.btinternet.com/~lfl_powell/ you will see what i am trying to do. Each square is a MC with a transparant button played over the top to trigger. However when you run the mouse quickly over the series of buttons some do not return to their original state! why>?

The MC's are 6 frames long with a stop command at 3 and a return to frame 1 and stop at 6. The buttons have a simple command of

on (rollOver, rollOut) {
tellTarget ("box1") {
play ();
}
}

I can't understand why sometimes this isn't working and is their an easier way of doing it?

Cheers L
PS Happy New Year

On Roll_out Keep Playhead Going...?
Hi people!

Can I ask for some help?

I have a button that activates a small animation on roll_over.

What I want to do is have it so:

on roll_out of the button the playhead keeps going to a certain frame (eg. 39) in the animation before stopping and executing the next piece of code.


Pseudo-code:

on (rollOut)
keep playhead going to frame (39)
then _root.mc_oo2.gotoAndPlay(frame 57);


Its basically so that if a user runs the mouse quickly on & off the button the animation will keep going rather than jerkingly stopping.

Hopes this makes sense.

Your help is, as ever, much appreciated guys!!

D.

On Roll_out Keep Playhead Going...?
Hi people!

Can I ask for some help?

I have a button that activates a small animation on roll_over.

What I want to do is have it so:

on roll_out of the button the playhead keeps going to a certain frame (eg. 39) in the animation before stopping and executing the next piece of code.


Pseudo-code:

on (rollOut)
keep playhead going to frame (39)
then _root.mc_oo2.gotoAndPlay(frame 57);


Its basically so that if a user runs the mouse quickly on & off the button the animation will keep going rather than jerkingly stopping.

Hopes this makes sense.

Your help is, as ever, much appreciated guys!!

D.

Stopping A MC On ROLL_OUT

Ive been trying all day and cant get the MC to stop playing.
I have a MC that I want to play over buttons when they are rolled over.
Class sparkle.
I want the MC to stop when the user rolls out.

I dont understand why Im getting this error or what the best way to achieve my desired result.

//Btn_Home_mc the instance of a particular button

Btn_Home_mc.buttonMode = true;

Btn_Home_mc.addEventListener(MouseEvent.ROLL_OVER, HomeSpark);
Btn_Home_mc.addEventListener(MouseEvent.ROLL_OUT, HomeSparkClear);


function HomeSpark(event:MouseEvent):void

{
    if (spark == null)
{
var spark:sparkle = new sparkle;
addChild(spark);
spark.x = 256.1;
spark.y = 276.7;

}
}

function HomeSparkClear(event:MouseEvent):void

{

    removeChild(spark);
    
}

ERROR

ReferenceError: Error #1065: Variable spark is not defined.

I tried every possible variation of moving and calling but dont get it..
please help...
thanks

[CS3] MOUSE_OUT/ROLL_OUT Events Question.
Hi all,

It has been since the days of AS 2.0 that I played with flash. Now I am trying to do in AS 3.0 what I was able to with 2.0 in the past. Specifically for this question, roll over and out tweens of MCs.

I have a MC with a tween labeled "start" and one labeled "out"

I am able to get the MC to play the "start" tween but not the "out" tween.

I am including my FLA and .AS files

Here is what I have in my .as file so far.


Code:
package {
import flash.display.Sprite;
import flash.events.MouseEvent;

public class MouseEvents extends Sprite {

public function MouseEvents() {
init();
}

picture_button.addEventListener(MouseEvent.CLICK,onMouseEvent);
picture_button.addEventListener(MouseEvent.DOUBLE_CLICK,onMouseEvent);
picture_button.addEventListener(MouseEvent.MOUSE_DOWN,onMouseEvent);
picture_button.addEventListener(MouseEvent.MOUSE_MOVE,onMouseEvent);
picture_button.addEventListener(MouseEvent.MOUSE_OUT,onMouseEvent);
picture_button.addEventListener(MouseEvent.MOUSE_OVER,onMouseEvent);
picture_button.addEventListener(MouseEvent.MOUSE_UP,onMouseEvent);
picture_button.addEventListener(MouseEvent.MOUSE_WHEEL,onMouseEvent);
picture_button.addEventListener(MouseEvent.ROLL_OUT,onMouseEvent);
picture_button.addEventListener(MouseEvent.ROLL_OVER,onMouseEvent);
}

public function onMouseEvent(event:MouseEvent.MOUSE_OVER):void {
picture_button.gotoAndPlay("start");
}
public function onMouseEvent(event:MouseEvent.ROLL_OUT):void {
picture_button.gotoAndPlay("out");
}
}
Any help will be appreciated! Thanks...

DG

ROLL_OUT Not Recognized When Cursor Leaves SWF
So I have a navbar that leaves frame when the mouse doesn't point to it. This works fine if I move the cursor off the navbar within the SWF Movie but if I move it off and out of the SWF Movie the ROLL_OUT event never takes place.

Is there an Event I can check for the mouse leaving the SWF?

stage.addEventListener(Event.ENTER_FRAME, checkMousePosition);
private function checkMousePosition(e:Event):void {
if (stage.mouseY > sectionNavbarYIn) {
if (sectionNavbar.y > sectionNavbarYIn) {
sectionNavbar.y -= movementBuffer;
}
} else {
if (!sectionNavbarAnchor) {
if (sectionNavbar.y < sectionNavbarYOut) {
sectionNavbar.y += movementBuffer;
}
}
}
}

Ease Out & Remove MovieClip When ROLL_OUT
Hi
When ROLL_OVER the first image (typ: button) "map", the "panorama" image Tween (typ: movieClip) appears and starts to move on x --> that works.

Now the PROBLEM is, that when ROLL_OUT on "panorama" the Tween to Fade Out (twOut) doesn't Fade Out and take the panorama MovieClip away. It should be a nice little Fade (EaseOut) Effect, not like removeChild(panorama).

Does anybody have an clue what the problem is in the script below?

Another thing is, that I can't track the position of the "panorama.x" whilest it is moving... any ideas?



ActionScript Code:
import fl.transitions.Tween;
import fl.transitions.TweenEvent;

import fl.transitions.easing.*;

var timer:Timer = new Timer(1000);
timer.addEventListener(TimerEvent.TIMER, moveit);

//Set Map on Stage
var map:Map = new Map();
map.x = 400;
map.y = 130;
addChild(map);

var panorama:Panorama = new Panorama();
panorama.x = 0;
panorama.y = 130;

map.addEventListener(MouseEvent.ROLL_OVER, over);
panorama.addEventListener(MouseEvent.ROLL_OUT, out);

var twA:Tween = new Tween(panorama, 'alpha', Regular.easeOut, 0, 1, 20, false);
var twOut:Tween = new Tween(panorama, 'alpha', Regular.easeOut, 0, 1, 20, false);

twA.stop();
twOut.stop();


// roll Over
function over(e:MouseEvent):void
{
    trace("over");
    addChild(panorama);
    twA.start();
    twOut.stop();
    timer.start();
}

// roll Out
function out(e:MouseEvent):void
{
    // it doesn't fade out and remove the mc
    twOut.start();
    //removeChild(panorama);
    trace("out");
    timer.stop();
    e.target.removeEventListener(Event.ENTER_FRAME, speed);
}


// timer move panorama on x
function moveit(e:TimerEvent):void
{
    trace("start timer");   
    panorama.x -= 1;
   
       // track position?????
    if(panorama.x == -995)
    {
        trace("end pos");
        //panorama.x += 2;
    }
    panorama.addEventListener(Event.ENTER_FRAME, speed);
}

//speed
function speed(e:Event):void
{
    e.target.x -= 2;
}

[AS3] Images Not Registering ROLL_OUT Event
Here is the Project

They work fine if you are slow, but if you just brush one of the hotspots the thumbnail will stick on the screen. I assume this is a fairly common problem. I've searched and read docs until my eyes bleed, so if anybody knows an obvious solution or can just point me in the general direction it would be mightily appreciated

Here's the code. It's a bloody mess. This is my first AS3 project. Works though.


PHP Code:



package {    public class Walkaround extends Sprite    {        private var index:uint = 1;        private var count:uint = 0;        private var done:Boolean = false;                private var _displayedThumb:Sprite = new Sprite( );        private var _loadXML:XMLLoader;        private var _loader:Loader = new Loader(  );        private var _nameList:XMLList;        private var _planeURL:DisplayObject;        private var _locationList:Array = new Array();        private var _markerXML:XML;        private    var _xCoord:int;        private    var _yCoord:int;        private var markerHolder:Sprite = new Sprite();        private var _markerContent:DisplayObject;        private var _thumbOn:Boolean = false;                private const X_SHIFT:int = 100;        private const Y_SHIFT:int = 75;        private const PATH_TO_IMAGES:String = new String("images/plane/");        private const PATH_TO_THUMBS:String = new String("images/plane/thumbs/");                        public function Walkaround()        {            // lets not scale            stage.align = StageAlign.TOP_LEFT;            stage.scaleMode = StageScaleMode.NO_SCALE;            // change frame rate to 30 fps:            stage.frameRate = 30;            loadXML("walkaround.xml");        }                private function loadXML(theXML:String):void {            // load xml            _loadXML = new XMLLoader();            _loadXML.addEventListener(Event.OPEN, onOpen);            _loadXML.addEventListener(Event.COMPLETE, onComplete);            _loadXML.load(new URLRequest(theXML));        }                private function drawPlane(event:Event):void {            var bitmapData:BitmapData = new BitmapData(_planeURL.width, _planeURL.height, true, 0xFFFFFF);            bitmapData.draw(_planeURL);            var thePlane:Bitmap = new Bitmap(bitmapData);            thePlane.x = 163 - X_SHIFT;            thePlane.y = 192 - Y_SHIFT;            addChildAt(thePlane, 0);        }            private function onOpen(evt:Event):void {                            addEventListener(Event.ENTER_FRAME, onEnterFrame);        }                private function onComplete(evt:Event):void {            done = true;        }                private function onEnterFrame(evt:Event):void {            addChild(markerHolder);                        // list of images in XML elements            var imageList:XMLList;                        // draw the plane            var bmLoader:Loader = new Loader;            bmLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, drawPlane);            var bmRequest:URLRequest = new URLRequest(String("images/737_top.png"));            bmLoader.load(bmRequest);            _planeURL = bmLoader                        //grab the XML            _markerXML = new XML(_loadXML.grabXML());            _nameList = _markerXML.marker;                        // create array of all markers            for each (var p in _nameList) {                                //grab the fields from xml                var type:String = _markerXML.marker[count].@type;                var name:String = _markerXML.marker[count].@name;                _xCoord = _markerXML.marker[count].@x - X_SHIFT;                _yCoord = _markerXML.marker[count].@y - Y_SHIFT;                var rotation:int = _markerXML.marker[count].@rotation;                imageList = _loadXML.getImages(count);                                //add current marker to array of the markers                _locationList["button" + count] = [type, name, _xCoord, _yCoord, rotation];                for each (var i in imageList) {                    _locationList["button" + count].push(i);                }                                // see what kind of marker it is and color it appropriatly                var markerColor:uint = new uint(0x00FF00);                                if (_locationList["button" + count][0] == "outside") {                    markerColor = 0xFF0000; //red                }                else if (_locationList["button" + count][0] == "under") {                    markerColor = 0x00FF00; //green                }                else {                    markerColor = 0x0000FF; //blue                }                                // Create the marker.                var marker:Sprite = new Sprite();                marker.name = "button"+count;                        // Disable the mouse events of objects inside the marker.                marker.mouseChildren = false;                        // Make the sprite behave as a marker.                marker.buttonMode = true;                        // Create a up state for the marker.                var up:Sprite = new Sprite();                up.graphics.lineStyle(1, 0x000000);                up.graphics.beginFill(markerColor);                up.graphics.drawRect(0, 0, 15, 15);                up.name = "up";                        // Create a over state for the marker.                var over:Sprite = new Sprite();                over.graphics.lineStyle(1, 0x000000);                over.graphics.beginFill(0xFFCC00);                over.graphics.drawRect(0, 0, 15, 15);                over.name = "over";                                // Adder the states and label to the marker.                marker.addChild(up);                marker.addChild(over);                        // Add mouse events to the marker.                marker.addEventListener(MouseEvent.MOUSE_OVER, markerOver);                marker.addEventListener(MouseEvent.MOUSE_OUT, markerOut);                marker.addEventListener(MouseEvent.CLICK, markerClick);                        // Add the button to the holder.                markerHolder.addChild(marker);                        // Position the marker.                marker.rotation = 0;                marker.x = _xCoord;                marker.y = _yCoord;                        // Hide the over state of the marker.                over.alpha = 0;                        // Increase the count.                trace("button" + count + ":  " + _locationList["button" + count]);                count++;                        }                        // wrap it up            if(done) {                trace(_locationList["button43"]);                removeEventListener(Event.ENTER_FRAME, onEnterFrame);            }        }                        private function markerOver(evt:MouseEvent):void {            // Hide the over state of the marker.             evt.currentTarget.getChildByName("over").alpha = 100;              var currentMarker:String = new String(evt.currentTarget.name);            _xCoord = _locationList[currentMarker][2] - X_SHIFT;            _yCoord = _locationList[currentMarker][3] - Y_SHIFT;            var currentThumb:String = new String(PATH_TO_THUMBS + _locationList[currentMarker][5]);            loadThumb(currentThumb);            evt.stopPropagation();            trace(evt.currentTarget.name);            trace("over: " + evt.type);        }                private function markerOut(evt:MouseEvent):void {            // clear thumb and return marker to proper color.            clearThumbs();                         evt.currentTarget.getChildByName("over").alpha = 0;            //trace(evt.currentTarget.name);            trace("out: " + evt.type);        }                private function markerClick(evt:MouseEvent):void {            evt.updateAfterEvent();            //trace(evt.currentTarget.name);            trace("click: " + evt.type);        }                private function drawThumb(evt:Event):void {                        if (!_thumbOn){                trace(_loader.hasEventListener(Event.COMPLETE));                // add a container to the stage for the thumbnail                addChild(_displayedThumb);                var loadedImage:Bitmap = Bitmap(_loader.content);                var bitmap:BitmapData = new BitmapData(loadedImage.width, loadedImage.height, false, 0xffffffff);                bitmap.draw(loadedImage, new Matrix(  ))                //put the bitmap in a var and display                var image:Bitmap = new Bitmap(bitmap);                image.x = _xCoord + 50;                image.y = _yCoord - 25;                _displayedThumb.addChild(image);                            _thumbOn = true;                trace("compl: " + evt.type);                this.dispatchEvent(evt);                                } else {                clearThumbs();                    drawThumb(evt);                            }        }                private function loadThumb(image:String):void {            _loader.contentLoaderInfo.addEventListener(Event.COMPLETE, drawThumb, false, 10);            _loader.load(new URLRequest(image));        }                private function clearThumbs():void {            if (_thumbOn) {                removeChild(_displayedThumb);                _displayedThumb = new Sprite ( );                _displayedThumb.mouseChildren = false;                _thumbOn = false;            }                    }            }} 

ROLL_OVER Behavior Inconsistent
I am working on a series of puzzle games.

Each piece is a movie clip. When the mouse rolls over a piece, its child object movie clip, called the "rotation mark", appears on the piece. (This is to allow the user to rotate the piece by clicking on it). When the mouse leaves the piece the rotation mark disappears.

I accomplish this by way of ROLL_OVER and ROL_OUT event handlers on the piece movie clip. On ROLL_OVER I simply set the rotation mark movie clip's visible property to true, and on ROLL_OUT I set it to true.


Here is what it looks like. (The mouse cursor doesn't get captured when you take a screen shot in Windows.)



When the mouse is moved over the rotation mark, inconsistent behaviour results:

1) When I try it with Control -> Test Movie in Flash it still seems to be considered "over" the piece.

2) However when I run the SWF embedded in an HTML file, moving the mouse over the rotation mark results in the piece dispatching a ROLL_OUT event.
(This causes the rotation mark to blink because when it's gone the piece fires ROLL_OVER, causing it to reappear, which causes the piece to fire ROLL_OUT again, ad infinitum.)

3) When I try it with Debug -> Debug Movie in Flash I get the same result as 2 above.

Why are these different? What is the expected behaviour.

One thing you may note is that all the MCs here (pieces as well as rotation mark) are loaded assets from external library SWFs. Before, when I had them all in a single SWF that was running I was getting the same results as 1 above in all cases. It was after I changed my design to have use a shell SWF and external libraries that this inconsistent behaviour began.

Any thoughts or ideas?

Image Is Replaced On ROLL_OVER?
How can I display a still image on the stage that loads on the first
frame and when the user rolls over a button, the button plays a movie
clip in place of the still image? So the image is temporarily swapped
with the movie clip.

I am currently using the following code provided in another thread to
make the movie clip play onrollover:


function showGraphic(event:MouseEvent):void {
mSymbol.visible = true;
}

function hideGraphic(event:MouseEvent):void {
mSymbol.visible = false;
}

btn.addEventListener(MouseEvent.ROLL_OVER, showGraphic);

btn.addEventListener(MouseEvent.ROLL_OUT, hideGraphic);



I am also using the following code to hide the movie clip on load:

mSymbol.visible = false;

Thanks!!!

ROLL_OVER Behavior Inconsistent
I am working on a series of puzzle games.

Each piece is a movie clip. When the mouse rolls over a piece, its child object movie clip, called the "rotation mark", appears on the piece. (This is to allow the user to rotate the piece by clicking on it). When the mouse leaves the piece the rotation mark disappears.

I accomplish this by way of ROLL_OVER and ROL_OUT event handlers on the piece movie clip. On ROLL_OVER I simply set the rotation mark movie clip's visible property to true, and on ROLL_OUT I set it to true.


Here is what it looks like. (The mouse cursor doesn't get captured when you take a screen shot in Windows.)



When the mouse is moved over the rotation mark, inconsistent behaviour results:

1) When I try it with Control -> Test Movie in Flash it still seems to be considered "over" the piece.

2) However when I run the SWF embedded in an HTML file, moving the mouse over the rotation mark results in the piece dispatching a ROLL_OUT event.
(This causes the rotation mark to blink because when it's gone the piece fires ROLL_OVER, causing it to reappear, which causes the piece to fire ROLL_OUT again, ad infinitum.)

3) When I try it with Debug -> Debug Movie in Flash I get the same result as 2 above.

Why are these different? What is the expected behaviour.

One thing you may note is that all the MCs here (pieces as well as rotation mark) are loaded assets from external library SWFs. Before, when I had them all in a single SWF that was running I was getting the same results as 1 above in all cases. It was after I changed my design to have use a shell SWF and external libraries that this inconsistent behaviour began.

Any thoughts or ideas?

AS3 Sound On Mouse Roll_over
hi... i've been experimenting with some buttons in AS3 and sounds... actually the buttons are movie clips and i'm trying to attach a sound to the ROLL_OVER action...
i used this code:


Code:
var buttonSound:Sound = new Sound();
var buttonSoundControl:SoundChannel = new SoundChannel();

buttonSound.load(new URLRequest("buttonsound.mp3"));

button_mc.addEventListener(MouseEvent.ROLL_OVER, RollOverListener);

function RollOverListener(e:MouseEvent):void
{
e.currentTarget.gotoAndStop(2)
e.currentTarget.buttonMode = true;
buttonSoundControl = buttonSound.play();
e.currentTarget.addEventListener(MouseEvent.CLICK, ClickListener);
}
so this code works.. but it loads the sound externally... and after a few minutes of browsing through the website the roll_over sound becomes laggy... i'm guessing it's because it loads over and over in the memory when hovering the buttons.. btw here is the website so you can try it for yourself:http://www.test.bvbusinessconsulting.ro/

my idea is to attach the sound to the swf file... i know that in AS2 there was a function attachSound() but this one is missing in AS3 and has now equivalent...
so if someone could help me on this one i would be really greateful!!

thanks in advanced!

AS3 - Stage Listener For ROLL_OVER
Hi!

When I add an event listener that listens for ROLL_OVER on the stage, it doesn't work. I know MOUSE_OVER works but that fire:s on every enterframe and that's not what I want. So, how come ROLL_OVER doesnt work and how does one create this kind of listener for the stage? I just want to know if the mouse is somewhere within the stage, adding some kind of old school "clickArea" MC or something like that just doesn't seem to be the best solution...

Ideas anyone?

Simple ROLL_OVER Question.
Hey i'm sure this is a simple question for someone, I have a header im working on thats is flash, and is basically images with a rollover and rollout using a class. Most the time it works without a hitch but sometimes it gets stuck between the rollover and rollout and pulsates. Should i apply the rollout when the tween is finished? Thanks! Any help appreciated.

Code:

package
{
   import flash.events.*;
   import flash.net.*;
   import flash.display.*;
   import caurina.transitions.Tweener;
   import flash.filters.DropShadowFilter;
   
   public class PARTYPURPOSE extends MovieClip
   {
      public function PARTYPURPOSE()
      {
      addEventListener(MouseEvent.ROLL_OVER, onOver);
      addEventListener(MouseEvent.ROLL_OUT, onOut);
      }
   
      public function onOver(event:MouseEvent):void
      {
      Tweener.addTween(event.target, { scaleX:.75, scaleY:.75, time:.5 } );
      event.target.filters = [new DropShadowFilter(0,0,0x000000,90,20,20,.8,3)];
      stage.addChild(this);
      }
   
      public function onOut(event:MouseEvent):void
      {
      Tweener.addTween(event.target, { scaleX:.5, scaleY:.5, time:1 } );
      event.target.filters = [];
      }
   
   } //ends class
} // ends package

and here you can see the actual application:
http://www.pawspetplace.com/nick

[CS3] MC Button Rollover State Stays On On ROLL_OUT
**It posted my thread with no title and I cant' edit it so I am reposting this for a better response.

Hi,

I have made 3 movieclip buttons and they are spaced about 15 pixels apart. I have them working but the problem is if I move my mouse over them fast the 'rollover state' will stay on. I can wiggle the mouse around and get them all to stay on if I wanted to.

It's not working satisfactory at all. I have had this happen before and it seems to happen when buttons are close together. I must be doing something wrong.

I'd like to solve this in AS3 if possible.

Here is my code:


Code:
but3.addEventListener(MouseEvent.ROLL_OVER, onButOver);
but3.addEventListener(MouseEvent.ROLL_OUT, onButOut);
but2.addEventListener(MouseEvent.ROLL_OVER, onButOver);
but2.addEventListener(MouseEvent.ROLL_OUT, onButOut);
but1.addEventListener(MouseEvent.ROLL_OVER, onButOver);
but1.addEventListener(MouseEvent.ROLL_OUT, onButOut);

function onButOver (event:MouseEvent) {
event.currentTarget.gotoAndPlay("over");
}
function onButOut (event:MouseEvent) {
event.currentTarget.gotoAndPlay("out");
}
Now this works, but the "over" state stays on on mouseout if I move quickly off the button.

Any help would be GREATLY APPRECIATED! This is for work and I need to do this!

MouseEnabled, MouseChildren And Still ROLL_OUT Is Beeing Propagated
Simple example.

ActionScript Code:
import flash.events.*;

clip.addEventListener( MouseEvent.ROLL_OVER, function( event:Event )
{
    trace( "over " );
    clip.mouseEnabled = false;
    clip.mouseChildren= false;
} );
clip.addEventListener( MouseEvent.ROLL_OUT, function( event:Event )
{
    trace( "out " );   
} );
Even though mouseEnabled is set to false, still ROLL_OUT is cought. Its propably cause mouse GOES out of the object, but I dont think it should be like this.

Suggestions or ideas how to handle this ? Or at least the true reason
I know that I may place some kind of bool flag in there, but its aint solution for the problem

Right Clicking And Opening Context Menu Causes ROLL_OUT
I have an object that is listening for a MouseEvent.ROLL_OUT which makes it hide. but its child element has a context menu, but when you right click the child and the context menu opens under the mouse it involks the ROLL_OUT for the container object and causes the entire thing to hide. If theres a way to tell the ROLL_OUT to not involk when the mouse is on the context menu?


Thanks!

AddEventListener To MouseEvent.Roll_Over Not Working
Alright, so I'm an intermediate with flash but really new to AS 3.0. I've recently started using Flash 9 with CS3 and am having a bear of a time with this one small issue.
Here is the file in use
http://www.cyan-studios.net/hpe2/

It's the left side of the header. So far, I've only made the first drop down menu, under "about us" work. Sort of. If you hover over "Locations", the flyout menu appears. Then if you hover over "Clients", that flyout then appears. Now try going back to the "Locations" button. No flyout.

The drop down from "About Us" is a movie clip called "About us" and it appears in frame 2 of the main scene. Clicking or hovering over the "About Us" button drives us over to frame 2. Not an issue there.

In the "About Us" movie clip, we have a similar setup. Frame 2 shows the flyout menu from locations. Frame 3 shows the flyout menu for "Clients". Frame two is labeled "locationstier2" and frame three is "clientstier2" in this movie clip.

My issue is, why doesn't the flyout reappear next to "Locations" after you've moved on to "Clients" unless you reset it by mousing away?

Here is the action script on the top layer as it spans across the three frames.


Code:
locationsclick.addEventListener(MouseEvent.MOUSE_OVER,locationsover);
clientsclick.addEventListener(MouseEvent.MOUSE_OVER,clientsover);
function locationsover(event:MouseEvent): void {
gotoAndPlay("locationstier2");
}
function clientsover(event:MouseEvent):void {
gotoAndPlay("clientstier2");
}

? ROLL_OVER Not Working Over Whole Object Area ?
Hi,

Now I am experiencing some weirdness on my roll-overs. I have a movieClip called "illustration". Illustration contains three children: "IllustrationText", "IllustrationTextRed", and a square vector graphic (distorted in illustrator) to sit below those two text objects.

My code:


PHP Code:



illustration.addEventListener(MouseEvent.ROLL_OVER, onIllustrationOver);
illustration.addEventListener(MouseEvent.ROLL_OUT, onIllustrationOut);

function onIllustrationOver(event:MouseEvent):void
{
    illustration.swapChildren(illustration.illustrationText, illustration.illustrationTextRed);
}

function onIllustrationOut(event:MouseEvent):void
{
    illustration.swapChildren(illustration.illustrationText, illustration.illustrationTextRed);





The roll-over doesn't appear to be triggered by the square vector graphic (I want it to be triggered by this)
The roll over appears to be triggered by the text outline in some areas but in others it appears to be triggered by the square vector graphic.

Anybody ever seen this happen??

Thanks for your help!

-Brian

Dynamic MC Has Multiple Hotspots On ROLL_OVER?
Hello all,

I have tight deadline on commercial project done in as3, so forgive the brief post.

has anyone ever seen a dynamic button have multiple hotspots?

Objects inside my nav are triggering the rollOver rather than the entire nav.

a menu tab is created dynamically from a MC exported as a Class.
there is dynamic text and an image populating it from xml.
Behind those is a panel made in flash.

when I roll over the menu tab, both the text and the image trigger the rollOver function. Why the panel in the background doesn't I have no idea.
Its almost like the panel isn't there and it sees the image and text as two seperate targets.


Of course I can post my code, but I was wondering if anyone has experience with this.

Thanks in advance.

ActionScript 3 XML Basics - SelectedItem On ROLL_OVER?
Is there a way to modify this tutorial to execute selectedItem on ROLL_OVER instead of click?

I changed

lb.addEventListener(Event.CHANGE,itemChange);

to

lb.addEventListener(MouseEvent.ROLL_OVER, itemChange);

but when I rollover a list item I get:

TypeError: Error #1009: Cannot access a property or method of a null object reference.
at as3xml_finished_fla::MainTimeline/itemChange()

Thanks!

Event Handling And MOUSE.ROLL_OVER And MOUSE_OVER
hello everyone,

i have been learning AS3 for couple of weeks now and been getting with creating my website. however, i have gotten to the point where interactivity needs to be implemented.

basically what i want is this:
i want to have for example two buttons or sprites on the stage not nested and have RollOver and RollOut events triggered accordingly. However, when MouseDown on Stage and then RollOver on btn1 or btn2 I dont want any events triggered. RollOver should be triggered only when directly RollOver or when MouseUp from Stage or other object.

Bellow is the code i have been writing and it does what i want to some extent:

what this code below does is this:
when MouseDown on Stage listener for RollOver on btn1 is removed
when MouseUp directly on Stage listener for RollOver on btn1 is added
when MouseDown on Stage and MouseUp on btn1 RollOver on btn1 is called (exactly what i needed when i add tweens)

???? the question still remains now, what about if i have more then one button and when you MouseDown on Stage and MouseUp on respective button all RollOver events will be triggered.

Any ideas on how to implement this better, anyone?

What about using some custom events and dispatch them accordingly? I am still learning AS3 therefore i do not have enough overall knowledge about the best implementation and how to go about things.

Here is the code:

stage.addEventListener(MouseEvent.MOUSE_DOWN, onMouseDown_stage);
trace("Added MouseDown on Stage");

btn1.addEventListener(MouseEvent.ROLL_OVER, onRollOver_btn1);
trace("Added RollOver on btn1");

private function onRollOver_btn1(e:MouseEvent):void {
trace("RollOver btn1" + e.target + e.currentTarget + e.eventPhase);
btn1.removeEventListener(MouseEvent.ROLL_OVER, onRollOver_btn1);
trace("-removed RollOver btn1");
btn1.addEventListener(MouseEvent.ROLL_OUT, onRollOut_btn1);
trace("+added RollOut btn1");
trace("-removed MouseDown Stage" + e.target + e.currentTarget + e.eventPhase);
stage.removeEventListener(MouseEvent.MOUSE_DOWN, onMouseDown_stage);
trace("-removed MouseUp Stage" + e.target + e.currentTarget + e.eventPhase);
stage.removeEventListener(MouseEvent.MOUSE_UP, onMouseUp_stage);
}

private function onRollOut_btn1(e:MouseEvent):void {
trace("RollOut btn1 " + e.target + e.currentTarget + e.eventPhase);
btn1.removeEventListener(MouseEvent.ROLL_OUT, onRollOut_btn1);
trace("-removed RollOut btn1");
btn1.addEventListener(MouseEvent.ROLL_OVER, onRollOver_btn1);
trace("+added RollOver btn1");
stage.addEventListener(MouseEvent.MOUSE_DOWN, onMouseDown_stage);
trace("+added MouseDown Stage");
}

private function onMouseDown_stage(e:MouseEvent):void {
if(e.target == e.currentTarget){
trace("MouseDown directly Stage" + e.target + e.currentTarget + e.eventPhase);
stage.removeEventListener(MouseEvent.MOUSE_DOWN, onMouseDown_stage);
trace("-removed MouseDown Stage");
stage.addEventListener(MouseEvent.MOUSE_UP, onMouseUp_stage);
trace("+added MouseUp Stage");
btn1.removeEventListener(MouseEvent.ROLL_OVER, onRollOver_btn1);
trace("-removed RollOver btn1");
}
}

private function onMouseUp_stage(e:MouseEvent):void {
if(e.target == e.currentTarget){
trace("MouseUp direclty Stage" + e.target + e.currentTarget + e.eventPhase);
stage.removeEventListener(MouseEvent.MOUSE_UP, onMouseUp_stage);
trace("-removed MouseUp Stage");
stage.addEventListener(MouseEvent.MOUSE_DOWN, onMouseDown_stage);
trace("+added MouseDown Stage");
btn1.addEventListener(MouseEvent.ROLL_OVER, onRollOver_btn1);
trace("+added RollOver btn1");
}else{
trace("MouseUp somewhere else but Stage" + e.target + e.currentTarget + e.eventPhase);
onRollOver_btn1(e);
}
}

cheers,
janis

Loading Multiple Text Files On ROLL_OVER
ok.. I have many button.. they all need to load different external text files when user does a ROLL_OVER. I have managed to get it to not error with fairly cludgy code (I know I can make this much nicer, as I am resuseing so much code.. I just dont know how). However when I run the as file.. it doesnt load the external text, but also doesnt error..

Note the dynamic text box "brand_txt_box1(and 2)" is inside a movie clip, but I put test_txt_box1 (and 2) on th main stage just to be sure it wasnt a child issue.


ActionScript Code:
package {

    import flash.display.MovieClip;
    import flash.events.MouseEvent;
    import flash.events.Event;
    import flash.net.URLLoader;
    import flash.net.URLRequest;
    import flash.text.TextField;
    import flash.display.SimpleButton;
   
   
    public class market_process extends MovieClip {


        public function market_process() {
            trace("this is working");
            //brand_box1.brand_txt_box1.visible = false;
            //brand_box2.brand_txt_box2.visible = false;
           
            brand_btn.addEventListener(MouseEvent.ROLL_OVER, beginButtonOver);
            brand_btn.addEventListener(MouseEvent.ROLL_OUT, beginButtonOut);

            targetComp_btn.addEventListener(MouseEvent.ROLL_OVER, targetCompButtonOver);
            targetComp_btn.addEventListener(MouseEvent.ROLL_OUT, targetCompButtonOut);
            //Many More Buttons (total 14)

       
        }
        private function textLoadvaribles() {
            // I included only 2 of each, though I have 14 of each.. 2 textboxes for each button

            var brand_txt1_req:URLRequest = new URLRequest("textfiles/1.txt");
            var brand_txt2_req:URLRequest = new URLRequest("textfiles/2.txt");
       
           
            var brand_txt1_2_req:URLRequest = new URLRequest("textfiles/1_2.txt");
            var brand_txt2_2_req:URLRequest = new URLRequest("textfiles/2_2.txt");
           
           
            var brand_txt1_load:URLLoader = new URLLoader();
            var brand_txt2_load:URLLoader = new URLLoader();
       
           
            var brand_txt1_2_load:URLLoader = new URLLoader();
            var brand_txt2_2_load:URLLoader = new URLLoader();



            brand_txt1_load.load(brand_txt1_req);
            brand_txt2_load.load(brand_txt2_req);
       
           
            brand_txt1_2_load.load(brand_txt1_2_req);
            brand_txt2_2_load.load(brand_txt2_2_req);
       
           


            brand_txt1_load.addEventListener(Event.COMPLETE, brand_txtReady1);
            brand_txt2_load.addEventListener(Event.COMPLETE, brand_txtReady2);
       
           
            brand_txt1_2_load.addEventListener(Event.COMPLETE, brand_txtReady1_2);
            brand_txt2_2_load.addEventListener(Event.COMPLETE, brand_txtReady2_2);
       
           
        }

        private function brand_txtReady1(event:Event):void {
            brand_box1.brand_txt_box1.text = event.target.data;
            test_txt_box1.text = event.target.data;
        }
        private function brand_txtReady2(event:Event):void {
            test_txt_box2.text = event.target.data;
        }
   
       
       
        private function brand_txtReady1_2(event:Event):void {
            brand_box2.brand_txt_box2.text = event.target.data;
            test_txt_box2.text = event.target.data;
        }
        private function brand_txtReady2_2(event:Event):void {
            test_txt_box2.text = event.target.data;
        }
   
       
       
        //End Text Loader

       
    }
}

Event Handling And MOUSE.ROLL_OVER And MOUSE_OVER
Hello everyone,

For quite some time I have been trying to figure out ways how make the proper interactivity for my sprites.

The sample scenario is this basically:
------One container sprite lets call it (CONT) on the Stage holding two seperate sprites (BTN1) and (BTN2)
------CONT, BTN1, and BTN2 sprites have MOUSE_OVER, MOUSE_OUT, MOUSE_DOWN, and MOUSE_UP event listeners

Now, I also tried this with ROLL_OVER and ROLL_OUT events since they do not bubble but I cant get the outcome what i am looking for.

What i am trying to achieve is this:
///////// When mouse_over BTN1, then mouse_down on BTN1 and do mouse_up outside BTN1 and CONT meaning mouse_up on Stage then what should happen is this: mouse_out on BTN1, mouse_out on CONT and that's it.

Also, when mouse_down on Stage and mouse_over CONT and then BTN1 or BTN2 nothing should happen but it does with the code that i have been writing.

Your help or suggestions would be appreciated.

I have tried to check on mouse_up events whether e.target == e.currentTarget and if so then I know that mouse_down comes from the same sprite that mouse_up is triggered. But if i have two sprites like in the example above with BTN1 and BTN2, and i check for e.target and e.currentTarget then if mouse_down on BTN1 and mouse_up on BTN2 i still get the event triggered because e.target and e.currentTarget is of object Sprite.

Any ideas???

Thanks,
Janis

ROLL_OVER Button State "jumpy"?
I have created a circle where each sector (piece of pie) is a button which has a rollover state. All works fine as long as I move into a pice of the pie from the outside and leave via this path. As soon as I move from one piece to the next, everything becomes jumpy and in fact I can turn on several rollovers at the same time.
This happens regardless of me using a stop for the tweening.

See:
http://www.spallek.com/flash/freevis_menu.html

Here is the code for one piece of the pie (I also noticed that the hit area is not "solid" meaning its not over the whole sector despite the fact that the mc is exactly the shape of the sector--maybe related?):


Code:
var Ablauflink:URLRequest = new URLRequest("http://www.spallek.com");
Ablauf_hit_mc.alpha = 0;
Ablauf_sel_mc.alpha = 0;
Ablauf_txt_sel_mc.alpha = 0;
Ablauf_exp_mc.alpha = 0;

Ablauf_hit_mc.addEventListener(MouseEvent.CLICK, onAblClick);
Ablauf_hit_mc.addEventListener(MouseEvent.ROLL_OVER, AblOver);
Ablauf_hit_mc.addEventListener(MouseEvent.ROLL_OUT, AblOut);

function AblOver(event:MouseEvent):void
{
var myTweenAlphaOverAblaufBtn:Tween = new Tween(Ablauf_sel_mc, "alpha", Strong.easeOut, 0, 1, 2, true);

var myTweenAlphaOverAblaufTxt:Tween = new Tween(Ablauf_txt_sel_mc, "alpha", Strong.easeOut, 0, 1, 2, true);

var myTweenAlphaOverAblaufExp:Tween = new Tween(Ablauf_exp_mc, "alpha", Strong.easeOut, 0, 1, 2, true);

Waehlen_sel_mc.alpha = 0;
Waehlen_exp_mc.alpha = 0;
Waehlen_mc.alpha = 1;
Waehlen_txt_sel_mc.alpha = 0;

Ablauf_txt_mc.alpha = 0;
Technologie_sel_mc.alpha = 0;
Technologie_txt_sel_mc.alpha = 0;
Technologie_exp_mc.alpha = 0;
Vorteile_txt_sel_mc.alpha = 0;
Vorteile_sel_mc.alpha = 0;
Vorteile_exp_mc.alpha = 0
Indikationen_txt_sel_mc.alpha = 0;
Indikationen_sel_mc.alpha = 0;
Indikationen_exp_mc.alpha = 0;
Zentren_txt_sel_mc.alpha = 0;
Zentren_sel_mc.alpha = 0;
Zentren_exp_mc.alpha = 0
FAQ_txt_sel_mc.alpha = 0;
FAQ_sel_mc.alpha = 0;
FAQ_exp_mc.alpha = 0;
}

function AblOut(event:MouseEvent):void
{
if (myTweenAlphaOverAblaufTxt != null)
{
myTweenAlphaOverAblaufTxt.stop();
myTweenAlphaOverAblaufExp.stop();
}
var myTweenAlphaOverAblaufBtn:Tween = new Tween(Ablauf_sel_mc, "alpha", Strong.easeOut, 1, 0, 1, true);

var myTweenAlphaOverAblaufTxt:Tween = new Tween(Ablauf_txt_sel_mc, "alpha", Strong.easeOut, 1, 0, 1, true);

var myTweenAlphaOverAblaufExp:Tween = new Tween(Ablauf_exp_mc, "alpha", Strong.easeOut, 1, 0, 1, true);

Waehlen_sel_mc.alpha = 1;
Waehlen_exp_mc.alpha = 1;
Waehlen_txt_sel_mc.alpha = 1;
Waehlen_mc.alpha = 0;
Ablauf_txt_mc.alpha = 1;

}

function onAblClick(event:MouseEvent):void
{
navigateToURL(Ablauflink);
}

Ablauf_hit_mc.buttonMode = true;

ROLL_OVER Button State "jumpy"?
I have created a circle where each sector (piece of pie) is a button which has a rollover state. All works fine as long as I move into a pice of the pie from the outside and leave via this path. As soon as I move from one piece to the next, everything becomes jumpy and in fact I can turn on several rollovers at the same time.
This happens regardless of me using a stop for the tweening.

See:
http://www.spallek.com/flash/freevis_menu.html

Here is the code for one piece of the pie (I also noticed that the hit area is not "solid" meaning its not over the whole sector despite the fact that the mc is exactly the shape of the sector--maybe related?):








Attach Code

var Ablauflink:URLRequest = new URLRequest("http://www.spallek.com");
Ablauf_hit_mc.alpha = 0;
Ablauf_sel_mc.alpha = 0;
Ablauf_txt_sel_mc.alpha = 0;
Ablauf_exp_mc.alpha = 0;

Ablauf_hit_mc.addEventListener(MouseEvent.CLICK, onAblClick);
Ablauf_hit_mc.addEventListener(MouseEvent.ROLL_OVER, AblOver);
Ablauf_hit_mc.addEventListener(MouseEvent.ROLL_OUT, AblOut);

function AblOver(event:MouseEvent):void
{
var myTweenAlphaOverAblaufBtn:Tween = new Tween(Ablauf_sel_mc, "alpha", Strong.easeOut, 0, 1, 2, true);

var myTweenAlphaOverAblaufTxt:Tween = new Tween(Ablauf_txt_sel_mc, "alpha", Strong.easeOut, 0, 1, 2, true);

var myTweenAlphaOverAblaufExp:Tween = new Tween(Ablauf_exp_mc, "alpha", Strong.easeOut, 0, 1, 2, true);

Waehlen_sel_mc.alpha = 0;
Waehlen_exp_mc.alpha = 0;
Waehlen_mc.alpha = 1;
Waehlen_txt_sel_mc.alpha = 0;

Ablauf_txt_mc.alpha = 0;
Technologie_sel_mc.alpha = 0;
Technologie_txt_sel_mc.alpha = 0;
Technologie_exp_mc.alpha = 0;
Vorteile_txt_sel_mc.alpha = 0;
Vorteile_sel_mc.alpha = 0;
Vorteile_exp_mc.alpha = 0
Indikationen_txt_sel_mc.alpha = 0;
Indikationen_sel_mc.alpha = 0;
Indikationen_exp_mc.alpha = 0;
Zentren_txt_sel_mc.alpha = 0;
Zentren_sel_mc.alpha = 0;
Zentren_exp_mc.alpha = 0
FAQ_txt_sel_mc.alpha = 0;
FAQ_sel_mc.alpha = 0;
FAQ_exp_mc.alpha = 0;
}

function AblOut(event:MouseEvent):void
{
if (myTweenAlphaOverAblaufTxt != null)
{
myTweenAlphaOverAblaufTxt.stop();
myTweenAlphaOverAblaufExp.stop();
}
var myTweenAlphaOverAblaufBtn:Tween = new Tween(Ablauf_sel_mc, "alpha", Strong.easeOut, 1, 0, 1, true);

var myTweenAlphaOverAblaufTxt:Tween = new Tween(Ablauf_txt_sel_mc, "alpha", Strong.easeOut, 1, 0, 1, true);

var myTweenAlphaOverAblaufExp:Tween = new Tween(Ablauf_exp_mc, "alpha", Strong.easeOut, 1, 0, 1, true);

Waehlen_sel_mc.alpha = 1;
Waehlen_exp_mc.alpha = 1;
Waehlen_txt_sel_mc.alpha = 1;
Waehlen_mc.alpha = 0;
Ablauf_txt_mc.alpha = 1;

}

function onAblClick(event:MouseEvent):void
{
navigateToURL(Ablauflink);
}

Ablauf_hit_mc.buttonMode = true;

Tween Class: Can One Tween More Than One Property Using The Same Tween
I want to scale both the _xscale and the _yscale properties of a clip, using a single execution of the Tween Class. See example below:


Code:
import mx.transitions.Tween;
var myTween:Tween = new Tween(myMovieClip_mc, "_xscale", Strong.easeOut, myMovieClip_mc._xscale, 300, 5, false);

Since one property at a time must be passed as a string to the constructor, I tried the following code, but it does not work quite as flawless as I expected:


Code:
myTween.onMotionChanged = function() {
//trace( this.position );
myMovieClip_mc._yscale += (300 - myMovieClip_mc._yscale)/12;
};
Any suggestions?

ROLL_OVER Plays A MC And ON_CLICK Plays A MC?
I would like to have a series of buttons that onrollover play a MC on
stage and onclick play another MC on stage. I am currently using the
following code provided in another thread to make the movie clip play
onrollover:


function showGraphic(event:MouseEvent):void {
mSymbol.visible = true;
}

function hideGraphic(event:MouseEvent):void {
mSymbol.visible = false;
}

btn.addEventListener(MouseEvent.ROLL_OVER, showGraphic);

btn.addEventListener(MouseEvent.ROLL_OUT, hideGraphic);



I am also using the following code to hide the movie clip on load:

mSymbol.visible = false;


How can I modify this code to allow a user to also click on the button
and play a MC?

Thanks!!!!!

Using Stop(); On A Shape Tween Of A Swapped Movie Clip Symbol Within A Motion Tween
Thanks a lot for your time. I'm new to actionscript, and language syntax and I never really got along to begin with so I appreciate any help in the matter.

Basically the title says it all - I made a motion tween in the main scene, made a movie clip symbol (to shape tween a gradient) and added a stop(); inside the gradient-tweened-symbol. I then swapped the movie clip symbol with the motion tween in the main scene, and got exactly the effect I wanted (the item moved, then tweened itself) but the stop(); seems to have no effect.

I know this looks like one of those "that idiot didn't google before posting" questions, but I've been looking for about a half hour with different permutations of stop, doesn't work, actionscript, and flash, and I haven't found anything that seems to target this problem specifically.

If you've got any idea what's going wrong, please feel free to respond or show me how to better seek help on my own. Thanks again.

Tween Class If Moved Mc Passed Point Start Another Tween
Hey Actionscript Gurus

Now I am using the Tween Class to move some boxes in my movie, now I can move the first mc and then another mc after the first tween has finished with onMotionFinished but I was hoping someone could help with how do I start the second tween when the first mc has passed a certain _x coordinate.

ie starting the second mc moving while the first tween is still moving.

I am trying to do a intro loader for my front page controlling around 7 boxes. So I need to repeat this a few times.

Regs,
Jacko

Tween Class If Moved Mc Passed Point Start Another Tween
Hey Kirupa Flash Gurus

Now I am using the Tween Class to move some boxes in my movie, now I can move the first mc and then another mc after the first tween has finished with onMotionFinished but I was hoping someone could help with how do I start the second tween when the first mc has passed a certain _x coordinate.

ie starting the second mc moving while the first tween is still moving.

Regs,
Jacko

Laco Tween Engine Versus Flash Native Tween
i am wondering if there is a way to put a delay (seconds) on the flashs' native tween class like you can on the laco tween engine... such as

Code:
#include "lmc_tween.as"
my_mc.tween("_x",100,1,"easeOutStrong",1.5,callbackFunction)
where "1.5" is would be the one and a half second delay before the tween starts. this is very useful to me because i dont have to use a callback function or an onMotionFinished function to start a new tween.

thanks in advance to anyone who can teach me

-frankf

Tween Class Scaling Breaks Motion Tween?
I have a movie clip which uses a motion guide to animate the entry (and eventually the exit) of a bunch of other movie clips. These smaller clips contain buttons, and animate on rollOver and rollOut using the following code:


Code:
on(rollOver) {
this.swapDepths(2);
ParentxScale = new mx.transitions.Tween(this, "_xscale", mx.transitions.easing.Back.easeOut, this._xscale, 100/.6, .5, true);
ParentyScale = new mx.transitions.Tween(this, "_yscale", mx.transitions.easing.Back.easeOut, this._yscale, 100/.6, .5, true);
play();
}
on(rollOut) {
ParentxScale = new mx.transitions.Tween(this, "_xscale", mx.transitions.easing.Bounce.easeOut, this._xscale, 100, .5, true);
ParentyScale = new mx.transitions.Tween(this, "_yscale", mx.transitions.easing.Bounce.easeOut, this._yscale, 100, .5, true);
stop();
}
However, once an object has been moused over, it doesn't exit with the others. Any ideas why it seems to "fall off the track" of the motion guide?

Shape Tween Like A Motion Tween, Using Guide Layer
How if possible, can i make a shape tween behave and follow a set path (like using a guide layer)while morhping/tweening?

So far it seems as each time i try it always goes in a straight line from a to b and in this case that's not what i'm after.

Diference Between Motion Tween And Shape Tween
What exactly is the difference between a motion tween and a shape tween?

What's The Best Way To Do A Motion Tween And A Shape Tween At The Same Time?
Hi all,

I'm having some difficulty doing this. I have tried motion tweening a movie clip containing a shape tween but it just doesn't look right. Anybody have any ideas?

Cheers

Do I Use A Shape Tween? Mask? Motion Tween?
How do I make this arrow grow into shape? I want it to slowly appear...but not fade in...

it's hard to explain...but here is the arrow, hopefully you will understand what I want...

I tried using a mask, but instead of revealing the arrow little by little, it dissapeared little by little...(basically the exact opposite)...

I also tried putting a white box over it & motion tweening the box to reveal the arrow...but that didn't look good...


any ideas?...suggestions?

thanks in advance...

What's The Difference Between A Shape Tween And A Motion Tween?
Hi!
I just wanted to ask that what is the difference between a shape tween and a motion tween???

Not to bother you.

please reply me back

[MX04] Shape Tween And Motion Tween
Why do Flash doesn't allow ungrouped objects into motion tween and symbols into shape tween?

Copyright © 2005-08 www.BigResource.com, All rights reserved