URGENT: Problem of EVENT listener

Hi all
Thanks for your time. I am facing a little problem with the event dispatcher and the event listener to be added. Well, I'll explain the problem.

I have a MovieClip named BUTTON_SET and I gave "ButtonSet.as" class link.
Inside this BUTTON_SET, I'll have a few buttons and they also have "UIButton.as" as a binding class

UIButton expedition press and release events, but unable to capture it using the button class. Here, I enclose the Code and I gave the URL Source too.

to my knowledge: UIButton class is not triggered when the button is ready for addListener.
Please help me solve this problem.

If I can't find a solution, I need to change all my class structures.

CLICK HERE TO SEE THE SOURCE CODE

According to your Code, when you call the InitHandler Functionction buttons may or may not be launched. Then use the Enterframe to check if its charging or not.

Note that in the button to replace the Manager call init.

this.onEnterFrame = Delegate.create (this, initHandler);

a_l'_interieur_de this initHandler, remove the function that will help you if you do not use any Enterframe for any other manipulation)

delete this.onEnterFrame;

Tags: Adobe Animate

Similar Questions

  • Problem with event listener

    Hello

    We have an event listener that does not seem to receive all events insertion of a table.

    Here is the SYS. Order ADD_LISTENER that we use:

    call the SYS. ADD_LISTENER ('tpch ', 'SQLFIRE', 'lineitem', 'demo.vmware.sqlfire.greenplum.MultiHubProxyDispatcher',' connectionurl = jdbc:sqlfire: | numproxies = 4 | sqlfire = username: password = sqlfire ", null);

    MultiHubProxyDispatcher() code distributes the rows inserted between the four tables proxy (proxy_0 through proxy_4). I have attached the MultiHubProxyDispatcher() code in this post.

    Thus, after 2400 lines are inserted in the lines of only about 125 lineitem table are spread to each of the tables four proxy.

    sqlf > select count (*) in the sqlfire.lineitem;
    1
    -----------
    2400

    1 selected line
    sqlf > select count (*) in the sqlfire.proxy_0;
    1
    -----------
    125

    1 selected line
    sqlf > select count (*) in the sqlfire.proxy_0;
    1
    -----------
    125

    1 selected line
    sqlf > select count (*) in the sqlfire.proxy_1;
    1
    -----------
    129

    1 selected line

    This same event receiver code worked with SQLFire v1.0, we have recently updated to v1.0.3.1 and that's when we started to see the problem. I don't see anything unusual in the newspapers. Is there something that has changed with the SYS. Order ADD_LISTENER are we missing?

    Thank you
    Sean

    Hi Sean,.

    I think you want to attach the code for demo.vmware.sqlfire.greenplum.MultiHubProxyDispatcher but I see only MicroBatchListener.

    Looks like you are using both the AsyncEventListener, but also the listener to table which could be added through the SYS. Procedure ADD_LISTENER.

    Can you please write how you use the combination.

    Please note async event listener cannot be added through sys.ad_listener.

    Thank you

    Neeraj

  • Menu/submenu management and problem of event listening

    Hi guys,.

    I'm creating a flashwebsite and I have a problem with the submenu appearing / disappering.

    What is extremely easy in html/jquery takes me overburned in actiuonscript: bring up a submenu only when the mouse cursor is on its button and not on himself.

    Indeed, I have my button/MC, which contains its submenu (which is a vertical list of MC), and when I go top, submenu appears, when I leave, submenu becomes invisible.

    BUT, when I go on the space below the button (where is my submenu invisible), submenu become visible, another time. I know that the cause is the listener associated with the main key is related to all its nested MC.

    My question is: there is a way of asserting a listener to a MC and not for all nested elements?

    If not, what shopuld do my pourpose?

    function createNav (lang: String = "it") {}


    var nav:Array = new Array ({label: "CHI SIAMO", url: "..."}) /Chi-siamo/index.php'},
    {label: 'PRODUZIONE ESECUTIVA', url: '... '} /Produzione-esecutiva/index.php'},
    {label: "FILMOGRAFIA", url: "..."} {"/ filmografia/index.php"},
    {label: "CAMPILOTS", url: ""},
    {label: "PROGETTI", url: ""},
    {label: "NEWS", url: ""},
    {label: "CONTACTS", url: ""},
    {label: "LANGUAGES", url: "", submenu: new Array ({label: "ITALIANO", url: ""},)}
    {label: "INGLESE" ", url:" "},
    {label: "TEDESCO" ", url:" "},
    {label: "INGLESE" ", url:" "}
    )});
    var navHeight:Number = 25; single height of the element

    CREATE BUTTON
    for (var i = 0; i < nav.length; i ++) {}
    var point: MovieClip = new NavLink();

    Item.Label.Text = nav [i] .label;
    Item.href = nav [i] .url;

    If (.submenu nav [i]! = null) {//SUBMENU CREATION

    for (var j: int = 0; j < nav [i].submenu.length; j ++) {}
    Sublabel var = new SubLabel();
    subLabel.x = subLabel.y = 18 * (j + 1);
    subLabel.tfMC.text = nav [i] .submenu [j] .label;
    item.addChild (subLabel);
    }
    }

    item.buttonMode = true;
    item.mouseChildren = false;
    item.addEventListener (MouseEvent.CLICK, {Function
    href = e.target.href;
    gotoAndPlay ('page2page');
    });

    var subMenuAnim:Array = new Array();

    item.addEventListener (MouseEvent.MOUSE_OVER, {Function
    var iconCocc:MovieClip = e.target.coccinella;
    var iconRotTween:Tween = new Tween (iconCocc, "rotation", Back.easeOut, iconCocc.rotation, (iconCocc.rotation + ((Math.random () * 200) + 200)), 2, true);

    APPREAING ANIMATION
    }
    });

    item.addEventListener (MouseEvent.MOUSE_OUT, {Function
    for (var i: int = 0; i < subMenuAnim.length; i ++) {}
    DISAPPREAING ANIMATION
    }
    subMenuAnim = new Array();
    });

    Item.y = navHeight * i;
    Item.Visible = false;

    Item.Coccinella.rotation = (Math.Random () * 200);

    nav_container. AddChild (Item);
    }

    What you do to make the submenu invisible?  If you set its visible property to false it does not interact with the mouse, but if you change its property alpha to 0, it will react.

  • Strange problem with the keyboard event listener

    I have a full screen touch app. To close the application, I set an event listener on keyboard for the key "0". I don't want the press user due to some restrictions Alt + F4 key combination. Problems begin when the application loses focus. Here's the code;

    protected function onComplete(event:FlexEvent):void
    {

    this.setFocus ();
    this.addEventListener (KeyboardEvent.KEY_DOWN, trapKeys, true, 0, true);

    }

    private void trapKeys(e:KeyboardEvent):void {}

    If (e.keyCode == 96) {}
    This.Close ();
    }

    Else if (e.keyCode == 48) {}
    This.Close ();
    }

    }

    When the user change the screen to a different with Alt + TAB application, or any other combination of keys flex app loses focus and does not work when he turns back to my app "0". How can I solve this problem?

    Thanks in advance.

    Hi, Ahmed.

    I have absolutely no problem with the solution you are trying to set up - you use mode full-screen interactive mode of keyboard?

    Please consider:

    on full add keyboard listener

    protected function applicationCompleteHandler(event:FlexEvent):void

    {

    this.stage.addEventListener (KeyboardEvent.KEY_DOWN, trapKeys);

    };

    //

    protected function applicationActivateHandler(event:AIREvent):void

    {

    If (this.stage)

    {

    switch the State to display full-screen when activated

    If (this.stage.displayState! = StageDisplayState.FULL_SCREEN_INTERACTIVE)

    {

    this.stage.displayState = StageDisplayState.FULL_SCREEN_INTERACTIVE;

    };

    };

    };

    //

    private var exitHandled:Boolean = false;

    on NUMBER_0 | NUMPAD_0 exit-close

    protected function trapKeys(event:KeyboardEvent):void

    {

    If ((event.keyCode is Keyboard.NUMBER_0

    || event.keyCode is Keyboard.NUMPAD_0)

    (& this.exitHandled == false)

    {

    exitHandled = true;

    this.stage.removeEventListener (KeyboardEvent.KEY_DOWN, trapKeys);

    This.Close ();

    };

    }

    (Note: applicaton of the events 'applicatonComplete' and "applicationActivate" are routed to over managers)

    Kind regards

    Peter

  • Problem adding an event listener

    I'm new to Flex, but I try to learn to use with Apollo. I can't understand how to add an event listener for my component MX:HTML. (I think that this component is only for Apollo, but I can't seem to work for event listeners components!)

    When the MXML file begins to run, it adds the event listener:

    htmlcontent.addEventListener (PropertyChangeEvent.PROPERTY_CHANGE, golink);

    It should call the golink() function every time htmlcontent.location change (the URL of the HTML component), but it does not work.

    The program compiles, but never runs golink(). Why it won't work? Is there another way to add event listeners?

    Function of the event:
    private void golink(e:PropertyChangeEvent):void
    {
    ShowMessage ("goLINK!");
    If (textinputurl.text! = htmlcontent.location)
    {
    ShowMessage ("goLINK!");
    textinputurl. Text = htmlcontent.location;
    getCurrentCard;
    }
    }

    HTML element:
    < mx:HTML id = "htmlcontent" x = "0" width = "100%" y = "0" height = "100%" location = "main.html" visible = "true" / > "

    See the documentation for the component html again. I think it's locationChange is the event you want. I just looked at this component today, but don't have the documentation in front of me now. But I remember reading something like this. The propertyChange event is very generic; you are looking for something specific.

  • Global keyboard event listener?

    Is it possible to create a global keyboard event listener that is unrelated to a window, button, or other user interface element?  The best I could get to add the event to the window listener.  This only works if the window is active.  If the user clicks outside the window and then the receiver for the keyboard does not work.  In addition, when the dialog box appears first of all, it won't work until after the user has made some type of interaction with the window.  I want is to have keyboard shortcuts for users that work regardless of the place where they clicked on the screen, even if the dialogue window is not 'active'.  Is this possible?

    Here is the code I use to the receiver of keyboard for the window.

    mywindow.addEventListener ("keydown", function (k) {keyListen(k)});
    function keyListen(k){if(k.keyName=="Z"){alert("Do stuff here");}}
    

    I don't think that you can create listeners of world events, as for the first appearance of the dialog box, I solved this problem in my script: scripts buliarca BCM_ExtendShortcuts UI by a button activates the event listener to this button. A problem with attach listeners to window, it's in CC2015 events can only be attached to controls and not windows. Setting for windows works in CS6...

  • Cannot add event listener to instantiated Movie Clip

    Hi guys,.

    I have a clip that I'm loading dynamically in my scene when a key is pressed.  Then, I would like to add a mouse event listener to the Movie Clip object so it can trigger a function when clicked.  I get an error when you try to do this and cannot find a solution anywhere.

    Here is my code:

    newLayerBT.addEventListener (MouseEvent.CLICK, newLayerBT_CLICK);

    function newLayerBT_CLICK (MouseEvent): void {}

    layerCount = layerCount + 1;

    Make a new object in my class BlankLayerMC

    var newLayer:BlankLayerMC = new BlankLayerMC;

    addChild (newLayer);

    Position the new object

    newLayer.y = prevY + newLayer.height;

    Change the text inside the object in order to take account layerCount courses

    newLayer.layerName.text = 'Layer' + layerCount;

    newLayer.layerNum = layerCount;

    prevY = newLayer.y;

    My problem occurs with this line...

    newLayer.addEventListener (MouseEvent.CLICK, moveSelection);

    layerArray.push (newLayer);

    }

    function moveSelection(e:MouseEvent):void {}

    var t = e.target;

    layerSelectedGraphic.x = t.x;

    t.y = layerSelectedGraphic.y;

    }

    Any help would be greatly appreciated

    change:

    function newLayerBT_CLICK (MouseEvent): void {}

    TO:

    function newLayerBT_CLICK(e:MouseEvent):void {}

  • [noob] Help understand why the event listener continues even after the withdrawal.

    Hey again,

    I'll try to do my best to explain. I can get this to work properly, but I'd like to understand why what I did before was not working.

    I have a little trouble understanding why an event listener continues listening to even after that I delete it. I have a facility where a Parent MovieClip ("CampScene") is established and an event listener is added to the look for a function ("walkUpToCampfire") to see if a condition is true ("comingFromAx is true", that won't be true until later).

    If it is true, an animation plays, an event listener is added to see if the animation is made and if it's an event listener is added to listen for a click ("campScene.goToAx") to a new animation to play and other events. (It won't be true until later.)

    If this isn't true (which is the situation that I work with at the start), the event listener said listening for a click on "campScene.goToAx" is implemented immediately. The function following removes the event listener, so it is supposed to stop listening to a click and let an animation play throughout.

    The problem is a continuous click to be listened to and if you keep clicking on the reboot of animation every time, which is what I don't want to happen.

    --------------------------------------

    I'm able to resolve the problem by adding the line "campScene.removeEventListener (Event.ENTER_FRAME, walkUpToCampfire)"; or in mouseEnabled affecting false for "campScene.goToAx", but I try to understand what is happening.

    It is, even if I'm deleting the listener ("campScene.goToAx") in a function ("goToAxScene"), "campScene.addEventListener (Event.ENTER_FRAME, walkUpToCampfire)"; continues to wait for a mouse click, unless it is removed also?

    Again, I am trying to understand how it works.

    --------------------------------------

    This should be all ACEs. Of course, I would like to know if you need more information. (I can post the FLA / AS files if need be.)

    public void practice_adventure8() {}

    ...

    initial event listeners

    addEventListener (Event.ENTER_FRAME, CampScene);

    }

    public void CampScene(event:Event) {}

    remove the event listener
    removeEventListener (Event.ENTER_FRAME, CampScene);

    Add the first camp scene
    campScene.x = - 120;
    campScene.y = - 10;
    addChild (campScene);
    setChildIndex (campScene, 0);

    Add the event listener to see if guys works with camp fire or not
    campScene.addEventListener (Event.ENTER_FRAME, walkUpToCampfire);

    }

    IF RETURNING TO CAMPSCENE
    public void walkUpToCampfire(event:Event) {}

    If the guy is walking back to axe
    If (comingFromAx == true) {}

    event listeners
    campScene.guyAtCampScene.gotoAndPlay ("guyComingFromAx");
    campScene.addEventListener (Event.ENTER_FRAME, ifGuyDoneWalking);

    otherwise if initial creation
    } else {}

    remove the old event listener
    campScene.removeEventListener (Event.ENTER_FRAME, walkUpToCampfire);

    trace ("comingFromAx = false");
    event listeners
    campScene.addEventListener (Event.ENTER_FRAME, sceneHoverInfo);
    campScene.goToAx.addEventListener (MouseEvent.MOUSE_UP, goToAxScene);
    campScene.goToBridge.addEventListener (MouseEvent.MOUSE_UP, goToBridgeScene);
    }
    }

    IF RETURNING TO CAMPSCENE FACT
    public void ifGuyDoneWalking(event:Event) {}

    If the guy ended up in foot
    If (campScene.guyAtCampScene.currentLabel == "guyAtCampSceneNormal") {}

    reset the Boolean values of scene
    comingFromAx = false;

    Add event listeners
    campScene.addEventListener (Event.ENTER_FRAME, sceneHoverInfo);
    campScene.goToAx.addEventListener (MouseEvent.MOUSE_UP, goToAxScene);

    }
    }

    GET READY FOR THE NEW SCENE

    public void goToAxScene(event:MouseEvent) {}

    delete movement event listeners
    campScene.goToAx.removeEventListener (MouseEvent.MOUSE_UP, goToAxScene);


    stop all sounds

    SoundMixer.stopAll ();

    play the clip of guy walking to AxScene
    campScene.guyAtCampScene.gotoAndPlay ("guyGoingToAx");

    check the label to see if axScene must appear
    campScene.guyAtCampScene.addEventListener (Event.ENTER_FRAME, addScene);
    }

    Your best bet to solve why things happen is to make use of the trace function.  In this case, you may have a trace run every time this listener can addedand any time it is deleted.  In this way, you should be able to see if it was added in after he deleted.  If there are several places where it is added, then adjust your tracks to indicate which line is involved as well.

  • Remove the event listener, or y at - there no need?

    Gidday

    If I set up an event listener in a private function

    for example

    var myfile:File = new File();

    myfile.addEventListener (Event.SELECT, loadmyfile, false, 0, true);

    myfile.browseForOpen ("Select a file to import...", [myfileFilter]);

    what I have to remove the listener in loadmyfile(), or the listener goes away once Flash has left the current private function as var myfile was created at the breast of this?

    Thank you guys

    MyFile should be garbage collected (gc would be) because you have assigned the listener to be low with your last setting (and myfile is local to your service - private or public or otherwise, does not matter).  but there are so many problems with all that you are better off using a weak listener AND the removal of the listener.

    a bit of a stretch is better than underkill and gc system can use all the help it can get.

  • Please help, event listener is not listening

    Hey, I'm stuck trying to use a code that I used in the past to pass args via an event listener. I need to find a way to do

    That's what I'll do, using an inline function. I do not completely understand how it all works, but we know that in an FLA open it works and the other is not. The thrown error is #1178: any attempt of property inaccessible spotlightBox via a static reference type... "SpotlightBox is the name of the function that I'm moving data.

    The main difference in the two DFL is that, in the broken, it is built inside a loop for. But do not know how this is a problem. If you have some tips I would be very happy. My work time is tomorrow and I'm stuck.

    It is used inside a block for each sprite:

    addEventListener (MouseEvent.ROLL_OVER, function onRoll_Over(e:Event) {spotlightBox (e, new Array("5"))});

    And here's the function:

    function spotlightBox(e:Event,_arg:Array):void
    {
    trace(arg[0]);

    }

    use:

    addEventListener (MouseEvent.ROLL_OVER, function(e:Event) {spotlightBox (e, new Array("5"))});

    function spotlightBox(e:Event,_arg:Array):void
    {
    trace(arg[0]);

    }

    but your main problem uses a with() statement to add listeners.  It probably won't work.

  • Cannot remove the Image event listener

    I'm clearly missing something and would be grateful for the help.  I'm trying to run an event handler when a full picture of loading, then remove the Manager so that it does not once again the image needs to be reloaded later.

    The problem I'm having is that the event handler simple custom ' disappear, despite the call removeEventListener on the Image object.

    The following example illustrates the problem (the example do anything useful... it's just the shortest example to demonstrate the problem).  (To run the application, you will need to provide any file JPEG ol ' named 'myImage.jpg' in the directory 'src' to your project).

    What to expect to happen is:

    (1) at startup, the image loads and runs of loadComplete().

    2) loadComplete removes the event listener so that subsequent re-loads don't get re-triggers the Manager.  I want only the Manager to run once.

    3) 'loadComplete' should appear in the debug console.

    (4) a click on the button should display only 'change picture' in the debug console

    What I get instead is that Manager loadComplete is not removed, and whenever I click on the button, loadComplete runs when the image is re-load (i.e., each button click results in the showing in the debug console 'change picture' AND 'loadComplete' ).

    <? XML version = "1.0" encoding = "utf-8"? >
    " < = xmlns:mx mx:Application ' http://www.Adobe.com/2006/MXML "layout ="absolute"> "
    "<mx:Image width ="655"height ="181" source =" myImage.jpg" id ="MyImage" autoLoad ="true"="true"scaleContent complete =" loadComplete () " ="100"x ="100"/ >
    < mx:Button = "100" x = "341" label = "Button" click = "click (event)" / >
    < mx:Script >
    <! [CDATA]
    private void loadComplete(): void
    {
    trace ('loadComplete');
    myImage.removeEventListener ("complete", loadComplete);
    }
    private void click(evt:Event):void
    {
    trace ("change Image");
    myImage.load ("myImage.jpg");    Reload image even; This is just an example
    }
    []] >
    < / mx:Script >
    < / mx:Application >

    Hello

    You can only remove event listeners you added with the addEventListener() method in an ActionScript block. You cannot remove an event listener that has been defined in the MXML tag, even if it has been registered by using a call to the addEventListener () method that was made within an attribute of the tag.

    Check this page for reference.

    http://livedocs.Adobe.com/Flex/3/HTML/Help.HTML?content=events_05.html

    You can change the code a bit get it works

    
    
    private function myImage_creationCompleteHandler(event:FlexEvent):void
    {
         myImage.addEventListener("complete",myImage_completeHandler);
         myImage.load("myImage.jpg");
    }
    
    private function myImage_completeHandler(event:Event):void
    {
         myImage.removeEventListener("complete",myImage_completeHandler);
    }
    
  • On the motion tween event listener

    Hi all

    I have worked with Flasg CS4 HAVE 3.0 for a few weeks now, and I touched something that left me open-mouthed all by building a portfolio site.

    Staging:

    In order to maintain the low initial file size, I currently use UILoaders to control the content that is currently viewing.  I have five total UILoaders that change the source in that based on what the user clicks on the button.  Each UILoader is nested inside two clips so that I can control the transition animations and so they do not overlap.   Example:

    I.Index/Stage

    A.Parent Movie Clip

    1. nested Movie Clip with custom entering and leaving the motion tweens on the UILoader child.

    a. UILoader

    So far, I was able to use the buttons on the main to shoot to the top of the UILoaders eco-friendly stage.  When you click a button, an event listener calls the UILoader, sets its source and anime 'in' thanks to its parent movie clip.  When you click a different button to replace the source of the UILoader, the original source is anime 'out' with the same parent movie clip.

    Here's the problem:

    I can't understand how to change the source of the UILoader that after the custom motion tween is completed.  I know how to configure a listener of events on each button to change the source of its respectful UILoader, but I need the animation 'out' motion tween to complete to the UILoader before the new source is caught.

    It seems to me that there should be an event listener to attach to button, listen to an interpolation of specific movement at the end and attach a function to change the source of the UILoader only at this time there.

    Here's a sample script that toggles the IULoader source:

    content_mc.profile_btn.addEventListener (MouseEvent.CLICK, profileClick);


    function profileClick(e:MouseEvent):void {}
    profile_mc.profile_mc.profileLoader.source = "Profile.swf";
    profile_mc.gotoAndPlay ("Enter");
    }

    content_mc.work_btn.addEventListener (MouseEvent.CLICK, workClick);

    function workClick(e:MouseEvent):void {}
    profile_mc.gotoAndPlay ("Exit");
    }

    Any ideas?

    I would really appreciate it.

    Yes, you might have a function coded everywhere where he would be executed better and you could call this function at the end of the Tween.  If interpolation is inside a movieclip, then you can precede the function call with MovieClip (parent).  or MovieClip (root).  Depending on how deep you are on children...

    MovieClip (parent) .callFunction ();

    You can also assign an event listener personalized to the movieclip that listen to the parents.  At the end of the Tween in the mc, you might have...

    dispatchEvent (new Event ("imDone"));

    In your parent assign you a listener for the event to the mc.

    youTweeningMC. addEventListener ("imDone", eventHandler);

    function eventHandler(event:Event):void {}
    Regardless of your intentions
    }

  • How can I check if a function is or is not called the event listener? in Flash CS4 (AS3)

    Hello

    I ran into a small problem.

    I put an event listener inside a loop for and the loop inside a function.

    I want the loop for to end as soon as the listener of events inside the for loop calls the function.

    Here is the general code for a better image.

    Code:

    this.addEventListener(Event.ENTER_FRAME, function#1);
    function function#1(event:Event):void{
              if(something is true){
                        for(var i = 0; i < numOfmy_mcs; i++){
                                  this["my_mc_"+String(i)].addEventListener(MouseEvent.CLICK, function#2);
                        }
              }
    }
    function function#2(e:Event):void{
    //do something cool here
    } 
    

    Thanks for any help!

    You can determine what the event object dispatched using e.target and e.currentTarget.  and it is not supposed to return anything to a listener.

    everything you try to do?  Click on one of a large number of objects and make and/or determine what?

  • Keyboard event listener does not work in the browser

    Is there a reason why a keyboard event listener would not work if the flash is embedded in an HTML element? The rest of my game runs well in the background, but I can't launch the movieClip "nextCar." My code is below, if that makes a difference...

    goNow function (event: KeyboardEvent): void {}
    thisOtherKey = event.keyCode;
    If (thisOtherKey == 32) {}
    nextCar.gotoAndPlay (2);
    parkingQue.play ();
    tent ++;
    }
    }
    stage.addEventListener (KeyboardEvent.KEY_DOWN, goNow);

    This is perhaps a silly question, but have you tried to click on your swf file once it opens in the browser and then try the keyboard controls?

    I don't know any problems that may cause debugging workwhen event listeners, but not in a browser.  So I think that maybe your just not well centered on the swf.

  • Problems with events in flex

    Hello. I'm a guy AS2 and Flash CS3. I started to learn AS3 and Flex 3 transfer. But I had a problem w / events in AS3. I add a component of the canvas to the scene. On this canvas, I added 3 different events: mouse down, mouse move, and mouse upwards. When the mouse move is triggered, it is impossible for me to get the mouse an event triggered, and vice versa, when the mouse upward is triggered, there is no way to get the mouse don't move event triggered. Is there someone to help this newbie with this problem? Any help will be much appreciated.

    Code:

    " < = xmlns:mx mx:Application ' http://www.Adobe.com/2006/MXML layout "="absolute">
    < mx:canvas id = "myCanvas" x = "50" y = "50" width = "500" height = "500" click = "event_1 (); "mouseMove ="event_2 (); "mouseUp ="event_3 (); ">
    < / mx:Canvas >

    < mx:Script >
    <! [CDATA]
    Import mx.controls.Alert;
    import flash.events. *;
    public function event_1 (): void
    {Alert.show ("first event fired") ;}}
    public function event_2 (): void
    {Alert.show ("Second event fired") ;}}
    public function event_3 (): void
    {(Alert.show ("troisième événement déclenché) ;}}
    < / mx:Script >
    < / mx:Application >

    The problem is that your event listeners are not properly configured.

    Your "p1" to listen for the 'mouseUp' event because he was managing the events at this time.

    This is your modified and test code, as long as the mouse is down on the canvas, she fares at the time where you 'mouseUp' stop drawing.


    http://www.Adobe.com/2006/mxml"layout ="absolute"creationComplete =" initApp () ">"

    import com.myDomain.Lines.Main;
    Mx.graphics import. *;
    Import mx.binding.utils.BindingUtils;
    import flash.events.IOErrorEvent;
    import flash.events.Event;
    import flash.display. *;
    Import mx.controls.Alert;
    import com.myDomain.Lines.Main;
      
    public var p1:Main;
    public var pre:Number = 0;
      
    public function initApp (): void
    {
    P1 = new Main();
    this.addChild (p1);
              
    }
     
    public function prepToDraw (): void
    {
    pre = 1;
    }
     
    public void startDraw(event:MouseEvent):void
    {
    if(pre == 1)
    {
    P1. Graphics.Clear ();
    var newColor:int = 0xFF00FF;
    var iniX:Number = mouseX;
    var iniY:Number = mouseY;
    var lineWidth:Number = 10;
    P1. Graphics.LineStyle (width of stripe, newColor);
    P1. Graphics.MoveTo (gwenael, iniY);
    }
       
    imageView.addEventListener (MouseEvent.MOUSE_MOVE, drawLine);
    P1.addEventListener (MouseEvent.MOUSE_UP, stopDraw);
    }
      
    public void drawLine(event:MouseEvent):void
    {
    if(pre == 1)
    {
    P1. Graphics.LineTo (mouseX, mouseY);
    }
    }
    public void stopDraw(event:MouseEvent):void
    {
    imageView.removeEventListener (MouseEvent.MOUSE_MOVE, drawLine);
    }
     
     
    ]]>


     
    mouseDown = "{startDraw (event)}" > "
     



    HTH,

    Kenny

Maybe you are looking for

  • Vista x 64 Tecra M7-132

    I can't find driver for tecra M7 - 132 on vista x 64. Where can I get it?

  • QosmioPlayer for Qosmio G30-177

    I just purchased a Qosmio G30-177 from a friend, but it is not a "new" laptopand that's my problem. My Lappy can using QosmioPlayer, when my lappy disable I press one of the key AV 11 but my lappy does not begin QosmioPlayer, instead of that she goes

  • Battery P100 - where can I get one with life

    Anyone know where I can get a battery for my toshiba satellite p100-188, the provided just does not enough.thanks long in advance.

  • T430 screen upgrade?

    Is it possible to uprade HD T430 display it on a HD screen +?

  • Is this a bug in the xy-Graph?

    Hi Forum, I came across this problem while working on this thread (http://forums.ni.com/ni/board/message?board.id=170&message.id=478607#M478607). I add values from 0 to 1 to a graph XY-like in the image below. (And only in this way!) When the user pr