AddEventListeners

Hi, I am loading an external swf called "harley_movie.swf"
into my FLA.
I have created preloading animation in a MovieClip called
"preloader" identifier exported to actionScript under linkage).
I have to loadd the preloader into a blank MovieClip called
loader_mc. I created an addEventListner to listen for the loading
if the "harley_movie.swf" to be complete, and then run a function
that unloads the "preoader" ("unloadMovie"). It is not working, yet
this is what Adobe's Livedocs says to do. Here is the code. What
the heck am I doing wrong?

Well I have been through all those and I tried the onLoadInit
instead of onLoad. My problem is not quite the same as the one they
show, as I don't need to create a MovieClip, I already have.
Arrrrrrg.
Well thanks for the link, I'll keep plugging away....

Similar Messages

  • AddEventListeners to dynamically created MC's

    The following creates movieclips from XML. Everything works
    great.
    One problem however.
    I need each MC to have it's own mouse event listener and
    don't know how to achieve this because I don't have specific
    instance names to refer with.
    I want to update textfields etc, with specific data when a
    specific button is clicked.
    Here's what I have:

    import fl.containers.UILoader;
    var a:Array = new Array();
    var b:Array = new Array();
    var urlget:URLRequest = new URLRequest("www.yahoo.com");
    var urlReq:URLRequest = new URLRequest("
    http://www.clevelandbrowns.cc/XML/onlinegm.xml");
    var urlLoader:URLLoader = new URLLoader();
    urlLoader.load(urlReq);
    urlLoader.addEventListener(Event.COMPLETE, getXML);
    function getXML(evt:Event):void {
    var xml:XML = new XML(urlLoader.data);
    var xmlList:XMLList = xml.question;
    for(var i:uint =0;i<xmlList.length();i++)
    var s:String = new String(xmlList.title.text()
    a.push(s);
    var t:String = new String(xmlList.src.text());
    b.push(t);
    var button:Button = new Button();
    button.x = 100;
    button.y = 100 + i * 130;
    button.name = "box"+i;
    button.ul.source = b
    button.mouseChildren = false;
    button.buttonMode = true;
    addChild(button);
    button.addEventListener(MouseEvent.CLICK,
    genericClickHandler);
    function genericClickHandler(event:MouseEvent)
    trace(event.target.name)
    //Sample code
    //(event.target as Button).textField1.text = tempArray[
    <extract Index From event.target.name>]

  • Button addEventListeners

    I created several basic buttons in Flash 4 using ActionScript3.0
    Every time I try and activate the button I get an error message:
    1061: Call to a possible undefined method AddEventListener through a reference with static type Class.
    Here is my code:
    stop();
    import flash.events.MouseEvent;
    //---dish Button Timeline change--\\
    dishwasher_btn.addEventListener(MouseEvent.CLICK,mouseOn);
    function  mouseOn(event:MouseEvent):void{
    gotoAndStop(5);
    When I test the movie, it keeps running a loop and the movie never stops at the first frame nor does it allow me to hit the button and go to frame 5.
    How can I get this basic function to work?

    click file/publish settings/flash and tick "permit debugging".  retest.  the frame and line number of code that uses:
    AddEventListener
    instead of
    addEventListener
    will be listed.  fix it.

  • Why is the thumbnail images placed in different order than the xml?

    Hi all!
    This same code I have asked about before, and got excelent help, but this is a different problem so I just start a new thread.
    This is a code that open a XML file, containing a small list of images, and place them as thumbs on the page.
    It kinda work now, but the funny thing is, the order of the thumbs is totally scrambled compared to the xml list, and I can't just see why!
    It has something to do whith when the loaders gets transfered via addEventListener to the placePics function, more than that I cant find out!
    There may be the better way to put up this code. I just feel putting it up in two nested addEventListeners like this is not the best of practice. But I see no other way here...
    package {
         import flash.display.*;
          import flash.events.*;
          import flash.net.*;
          public class thumbHolder extends MovieClip {
                var xmlRequest:URLRequest;
                var xmlLoader:URLLoader;
                var imgData:XML;
                var numberOfChildren:Number;
                var currentImgNum:Number;
                var imgLoader:Loader;
                var imgContainer:Array = [];
                var currentImg:String;
                public function thumbHolder() {
                      currentImgNum = 0;
                      xmlRequest = new URLRequest("images.xml");
                      xmlLoader = new URLLoader(xmlRequest);
                      xmlLoader.addEventListener(Event.COMPLETE, handlePics);
                public function handlePics(e:Event):void {
                      imgData = new XML(e.target.data);
                      numberOfChildren = imgData.*.length();
                      for (var i:int = 0 ; i < numberOfChildren ; i++) {
                           currentImg = imgData.image[i].imgURL;
                           imgLoader = new Loader;
                           imgLoader.load(new URLRequest(currentImg));
                           imgLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, placePics);
              function placePics(e:Event):void {
                     var oldH:Number = e.target.loader.height;
                     var oldW:Number = e.target.loader.width;
                     e.target.loader.height = 100;
                     var prosent:Number = (e.target.loader.height / oldH) * 100;
                     e.target.loader.width = (prosent * oldW) /100;
                     imgContainer.push(e.target.loader);
                     imgContainer[currentImgNum].x = (e.target.loader.width * currentImgNum) + (currentImgNum * 5) + 6;
                     addChild(imgContainer[currentImgNum]);
                     currentImgNum++;

    Never mind! I finally managed to see what to do. Thanks for the help
    package {
         import flash.display.*;
         import flash.events.*;
         import flash.net.*;
         public class thumbHolder extends MovieClip {
              var xmlRequest:URLRequest;
              var xmlLoader:URLLoader;
              var imgData:XML;
              var numberOfChildren:Number;
              var currentImgNum:Number;
              var imgLoader:Loader;
              var imgContainer:Array = [];
              var currentImg:String;
              public function thumbHolder() {
                   currentImgNum = 0;
                   xmlRequest = new URLRequest("images.xml");
                   xmlLoader = new URLLoader(xmlRequest);
                   xmlLoader.addEventListener(Event.COMPLETE, handlePics);
              public function handlePics(e:Event):void {
                   imgData = new XML(e.target.data);
                   numberOfChildren = imgData.*.length();
                   adToArray(currentImgNum);
              private function adToArray(currNum:Number):void {
                   currentImg = imgData.image[currNum].imgURL;
                   imgLoader = new Loader;
                   imgLoader.load(new URLRequest(currentImg));
                   imgLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, placePics);
              function placePics(e:Event):void {
                   var oldH:Number = e.target.loader.height;
                   var oldW:Number = e.target.loader.width;
                   e.target.loader.height = 100;
                   var prosent:Number = (e.target.loader.height / oldH) * 100;
                   e.target.loader.width = (prosent * oldW) /100;
                   imgContainer.push(e.target.loader);
                   imgContainer[currentImgNum].x = (e.target.loader.width * currentImgNum) + (currentImgNum * 5) + 6;
                   addChild(imgContainer[currentImgNum]);
                   if (currentImgNum < numberOfChildren) {
                        currentImgNum++;
                        adToArray(currentImgNum);

  • How Can You Tell if the URLRequest Variables Are Posted?

    Hi,
    This sounds really odd, because I happen to have three variables I am supposed to pass to an httpservice and have the results output to my Flex app.
    The problem is, I don't know how I can tell if a variable has been posted or not, because no matter what I do, it looks like my trace statement is accurate, but there is nothing shown on the screen.
    I tried changing it to GET, and then I get this IO Event Handler error, because my variables are so long.
    var loader:URLLoader = new URLLoader();
            var url:String = "http://localhost/generic.php";
            var variables:URLVariables = new URLVariables();
                variables.from= from_string;
                variables.state_colors = state_colors_string;
                variables.change = change_string;                       
            var encode:String= encodeURI(url);
            var pattern:RegExp = /#/g;
            var decode:String = encode.replace(pattern,"%23");
            var request:URLRequest = new URLRequest(decode);           
            request.method = URLRequestMethod.POST;          
    I am wondering if my variables have been passed correctly. Is there some other way other than using trace statements?
    Thanks for your help.

    Hi,
    Thanks for the tip, and I have just done that with my php code end. It turns out that the file was generated, and the file is blank after the code has finalized execution.
      So, I guess that my POST variables is definitely not posted.
    By the way, I have added a couple of lines for security and IO checks, like you suggested, and here is the almost complete code:
    public function changeMap():void{                        
            var url:String = "http://localhost/generic.php";
            var variables:URLVariables = new URLVariables();
                variables.from= from_string;
                variables.state_colors = state_colors_string;
                variables.change = change_string;
            var encode:String= encodeURI(url);
            var pattern:RegExp = /#/g;
            var decode:String = encode.replace(pattern,"%23");
            var request:URLRequest = new URLRequest(decode);           
            request.method = URLRequestMethod.POST;       
            var loader:URLLoader = new URLLoader();
            loader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, onSecurityError);
            loader.addEventListener(IOErrorEvent.IO_ERROR, onIOError);
            loader.addEventListener(Event.COMPLETE, onLoadComplete);   
            loader.load(request);                    
             private function onSecurityError(event:SecurityErrorEvent):void {
                trace("securityErrorHandler: " + event);
             private function onIOError(event:IOErrorEvent):void {
                trace("ioErrorHandler: " + event);
            public function onLoadComplete(event:Event):void {             //event output                             
    From the console, the error events returned nothing from the addEventListeners.
    When I used GET before, they worked with two passing variables, but since my variables are now more than 512 characters, I cannot put this on the url, which is why I am insisting on using POST here.
    Have I done anything else wrong here?
    Thanks for your help.

  • Flattened circles in drawing api

    Hi Guys
    When I use the drawing api to create circles, sometimes they
    appear flattened, as if the edges had been sliced off. Below is the
    code. Can anyone tell me how to fix this?
    // extends UIComponent
    public function CircleThing ()
    super();
    mouseChildren = false;
    buttonMode = true;
    //resetCircle();
    base = new Sprite();
    baseOver = new Sprite();
    label = new TextField()
    label.autoSize = TextFieldAutoSize.LEFT;
    label.multiline = true;
    label.wordWrap = true;
    label.width = 108;
    label.x = -52;
    addChild(base);
    addChild(baseOver);
    addChild(label);
    addEventListeners();
    //label.border = true;
    //label.borderColor = 0xff0000;
    //addChild(label);
    //resetCircle();
    //addListeners();
    // This function creates the blue circle
    public function drawCircle(_name:String=null):void
    trace ('NavCircle drawCircle');
    var myFilters:Array = [new
    DropShadowFilter(5,135,0x000000,0.15,5,5)];
    //base.name = _name;
    base.graphics.clear();
    base.graphics.beginFill(_color, .9);
    base.graphics.drawCircle(0, 0, defaultDiameter/2);
    base.graphics.endFill();
    base.filters = myFilters;
    // added djg draw overCircle
    baseOver.graphics.clear();
    baseOver.graphics.beginFill(_overColor, 1);
    baseOver.graphics.drawCircle(0, 0, defaultDiameter/2);
    baseOver.graphics.endFill();
    baseOver.visible = false;
    }

    I'm not sure about tutorials, but read up on the
    flash.display.Graphics class. Your Canvas has a graphics property
    and that's where you draw. Here's how to draw a red circle 50
    pixels in diameter:
    graphics.clear();
    graphics.beginFill( 0xff0000 );
    graphics.drawCircle( 100, 100, 25 );
    graphics.endFill();
    You should do most of your drawing in the updateDisplayList
    function - just override it (in a Script block if using
    MXML).

  • How can I determine which image was clicked in 3D carousel?

    I have been modifying some 3D carousel code that I found in hopes that I can get it such that when image "resolv2.jpg" (or any of my other images) is clicked on at the front of my carousel, it goes to a specific webpage. By just replacing "moveBack(event.target) from the toggler section of the code with "navigateToURL:(newURLRequest('http://google.com'), the target DOES sucessfully go to google when clicked on. However, I want to modify this code by altering the else statement to say something to the effect of "else if event.target (clicked on object) is 'resolv2.jpg' THEN go to google". So essentially, my question is how can I determine which image was clicked? Here is the entire code with the area I was altering bolded:
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" applicationComplete="init();" backgroundGradientColors="[#000033, #000033]" backgroundGradientAlphas="[1.0, 1.0]">
    <mx:Script>
              <![CDATA[
    //Import Papervision Classes
                   import org.papervision3d.scenes.*;
                   import org.papervision3d.cameras.*; 
                   import org.papervision3d.objects.*;
                   import org.papervision3d.objects.primitives.*;
                   import org.papervision3d.materials.*;
                   import org.papervision3d.materials.shadematerials.*;
                   import org.papervision3d.materials.utils.MaterialsList;
                   import org.papervision3d.lights.*;
                   import org.papervision3d.render.*;
                   import org.papervision3d.view.*;
                   import org.papervision3d.events.*;
                   import org.papervision3d.core.*;
                   import org.papervision3d.lights.PointLight3D;
                   import flash.filters.DropShadowFilter;
                         import caurina.transitions.*;
                         private var numOfItems:int = 5;
                         private var radius:Number = 600;
                         private var anglePer:Number = (Math.PI*2) / numOfItems;
                         //private var dsf:DropShadowFilter = new DropShadowFilter(10, 45, 0x000000, 0.3, 6, 6, 1, 3);
                   public var angleX:Number = anglePer;
             public var dest:Number = 1;
                   private var theLight:PointLight3D;
            //Papervision Engine
                   private var viewport:Viewport3D; 
                   private var scene:Scene3D; 
                   private var camera:Camera3D;
                   private var renderer:BasicRenderEngine;
             private var planeArray:Array = new Array();
             [Bindable]
             public var object:Object;
             private var arrayPlane:Object;
             private var p:Plane;
             //Initiation function           
             private function init():void 
             viewport = new Viewport3D(pv3dCanvas.width, pv3dCanvas.height, false, true); 
             pv3dCanvas.rawChildren.addChild(viewport); 
             viewport.buttonMode=true;
             renderer = new BasicRenderEngine();
             scene = new Scene3D(); 
             camera = new Camera3D();
             camera.zoom = 2; 
             createObjects(); 
             addEventListeners();
    //Create Objects function          
              private function createObjects():void{
              for(var i:uint=1; i<=numOfItems; i++)
                        /* var shadow:DropShadowFilter = new DropShadowFilter();
                        shadow.distance = 10;
            shadow.angle = 25; */
                        var bam:BitmapFileMaterial = new BitmapFileMaterial("images/resolv"+i+".jpg");
                        bam.oneSide = false;
                        bam.smooth = true;
            bam.interactive = true;
                        p = new Plane(bam, 220, 200, 2, 2);
                        p.x = Math.cos(i*anglePer) * radius;
                        p.z = Math.sin(i*anglePer) * radius;
                        p.rotationY = (-i*anglePer) * (180/Math.PI) + 270;
                        scene.addChild(p);
                        //p.filters=[shadow];
                        p.extra={pIdent:"in"};
                        p.addEventListener(InteractiveScene3DEvent.OBJECT_PRESS, toggler);
            planeArray[i] = p;
              // create lighting
            theLight = new PointLight3D();
            scene.addChild(theLight);
            theLight.y = pv3dCanvas.height;
              private function toggler(event:InteractiveScene3DEvent):void
                            // if the cube's position is "in", move it out else move it back
                            if (event.target.extra.pIdent == "in")
                                    moveOut(event.target);
                            else
                                   moveBack(event.target);
                    private function moveOut(object:Object):void
                              trace(object +" my object");
                            // for each cube that was not selected, remove the click event listener
                            for each (var arrayPlane:Object in planeArray)
                                    if (arrayPlane != object)
                                            arrayPlane.removeEventListener(InteractiveScene3DEvent.OBJECT_PRESS, toggler);
                            //right.enabled=false;
                            //left.enabled=false;
                            // move the selected cube out 1000 and rotate 90 degrees once it has finished moving out
                            Tweener.addTween(object, {scaleX:1.2, time:0.5, transition:"easeInOutSine", onComplete:rotateCube, onCompleteParams:[object]});
                            Tweener.addTween(object, {scaleY:1.2, time:0.5, transition:"easeInOutSine", onComplete:rotateCube, onCompleteParams:[object]});
                            // set the cube's position to "out"
                            object.extra = {pIdent:"out"};
                            // move the camera out 1000 and move it the to same y coordinate as the selected cube
                            //Tweener.addTween(camera, {x:1000, y:object.y, rotationX:0, time:0.5, transition:"easeInOutSine"});
                    private function moveBack(object:Object):void
                            // for each cube that was not selected, add the click event listener back
                            for each (var arrayPlane:Object in planeArray)
                                    if (arrayPlane != object)
                                            arrayPlane.addEventListener(InteractiveScene3DEvent.OBJECT_PRESS, toggler);
                            // move the selected cube back to 0 and rotate 90 degrees once it has finished moving back
                            Tweener.addTween(object, {scaleX:1, time:0.5, transition:"easeInOutSine", onComplete:rotateCube, onCompleteParams:[object]});
                            Tweener.addTween(object, {scaleY:1, time:0.5, transition:"easeInOutSine", onComplete:rotateCube, onCompleteParams:[object]});
                            // set the cube's position to "in"
                            object.extra = {pIdent:"in"};
                            // move the camera back to its original position
                            //Tweener.addTween(camera, {x:0, y:1000, rotationX:-30, time:0.5, transition:"easeInOutSine"});
                            //right.enabled=true;
                            //left.enabled=true;
                    private function goBack():void
                            // for each cube that was not selected, add the click event listener back
                            for each (var arrayPlane:Object in planeArray)
                                    if (arrayPlane != object)
                                            arrayPlane.addEventListener(InteractiveScene3DEvent.OBJECT_PRESS, toggler);
                    private function rotateCube(object:Object):void
                            //object.rotationX = 0;
                            //Tweener.addTween(object, {rotationZ:0, time:0.5, transition:"easeOutSine"});
              private function addEventListeners():void{
        this.addEventListener(Event.ENTER_FRAME, render);
    //Enter Frame Listener function             
    private function render(e:Event):void{ 
                     renderer.renderScene(scene, camera, viewport);
                     camera.x = Math.cos(angleX) * 800;                                                  
                     camera.z = Math.sin(angleX) * 800;
    private function moveRight():void
              dest++;
              Tweener.addTween(this, {angleX:dest*anglePer, time:0.5});
              //goBack();
    private function moveLeft():void
              dest--;
              Tweener.addTween(this, {angleX:dest*anglePer, time:0.5});
              //goBack();
              ]]>
    </mx:Script>
              <mx:Canvas width="1014" height="661">
              <mx:Canvas id="pv3dCanvas" x="503" y="20" width="400" height="204" borderColor="#110101" backgroundColor="#841414" alpha="1.0" backgroundAlpha="0.57"> 
              </mx:Canvas>
              <mx:Button x="804" y="232" label="right" id="right" click="moveRight(),goBack()"/>
              <mx:Button x="582" y="232" label="left"  id="left"  click="moveLeft(),goBack()" />
              </mx:Canvas>
    </mx:Application>

    Your answer may be correct, but I am very much a beginner to actionscript, and I was wondering moreso if it is possible to determine the root/url (i.e. images/resolv2.jpg)? Or even if InteractiveScene3DEvent calls a variable that holds this url? However, specifically, I'm just wondering if the actionscript itself could determine the url in a line of code such as "if object == BitmapFileMaterial("/images/resolv2.jpg"); "? Also, here's a copy of InteractiveScene3DEvent in more detail if you think that will help:
    public class InteractiveScene3DEvent extends Event
                         * Dispatched when a container in the ISM recieves a MouseEvent.CLICK event
                        * @eventType mouseClick
                        public static const OBJECT_CLICK:String = "mouseClick";
                         * Dispatched when a container in the ISM receives an MouseEvent.MOUSE_OVER event
                        * @eventType mouseOver
                        public static const OBJECT_OVER:String = "mouseOver";
                         * Dispatched when a container in the ISM receives an MouseEvent.MOUSE_OUT event
                        * @eventType mouseOut
                        public static const OBJECT_OUT:String = "mouseOut";
                         * Dispatched when a container in the ISM receives a MouseEvent.MOUSE_MOVE event
                        * @eventType mouseMove
                        public static const OBJECT_MOVE:String = "mouseMove";
                         * Dispatched when a container in the ISM receives a MouseEvent.MOUSE_PRESS event
                        * @eventType mousePress
                        public static const OBJECT_PRESS:String = "mousePress";
                         * Dispatched when a container in the ISM receives a MouseEvent.MOUSE_RELEASE event
                        * @eventType mouseRelease
                        public static const OBJECT_RELEASE:String = "mouseRelease";
                         * Dispatched when the main container of the ISM is clicked
                        * @eventType mouseReleaseOutside
                        public static const OBJECT_RELEASE_OUTSIDE:String = "mouseReleaseOutside";
                         * Dispatched when a container is created in the ISM for drawing and mouse interaction purposes
                        * @eventType objectAdded
                        public static const OBJECT_ADDED:String = "objectAdded";
                        public var displayObject3D                                        :DisplayObject3D = null;
                        public var sprite                                                            :Sprite = null;
                        public var face3d                                                            :Triangle3D = null;
                        public var x                                                                      :Number = 0;
                        public var y                                                                      :Number = 0;
                        public var renderHitData:RenderHitData;
                        public function InteractiveScene3DEvent(type:String, container3d:DisplayObject3D=null, sprite:Sprite=null, face3d:Triangle3D=null,x:Number=0, y:Number=0, renderhitData:RenderHitData = null, bubbles:Boolean=false, cancelable:Boolean=false)
                                  super(type, bubbles, cancelable);
                                  this.displayObject3D = container3d;
                                  this.sprite = sprite;
                                  this.face3d = face3d;
                                  this.x = x;
                                  this.y = y;
                                  this.renderHitData = renderhitData;
    Thank you so much!

  • Drag and drop data from datagrid to textInput with flex.

    Hi,
      Cay please help me out on this problem..
      I have a datagid with some values..I have a textInput on the UI..
    There is one "+" button on the UI..when i click on that button it will add one more TextInput box to the UI below the first TextInput..Like thiseverytime  when you click on the "+" button it will add one more TextInput to the UI just below the previous one..
    Now i want to drag the values from datagrid to Textinput boxes..User may drag two or more vlaues to each textInput upon his requirement..
    How can i drag ...could you please help me out on thi issue....
    I am not able to drag the values to TextInputs:
    Here is my code:::Could anyone please help me...
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"   width="100%"  height="100%" creationComplete="init()">
    <mx:Script>
                <![CDATA[
                    import mx.containers.HBox;
                    import mx.controls.Alert;
                    import mx.managers.PopUpManager;
                //    import Components.testPopUpWindow;
                    import mx.core.UIComponent;
                    import mx.containers.TitleWindow;
                    import mx.core.DragSource;
                   // import mx.core.IUIComponent;
                    import mx.managers.DragManager;
                    import mx.events.DragEvent;
                    import mx.controls.Alert;
                    import mx.controls.Text;
                    import flash.geom.Point;
                 import mx.collections.ArrayCollection;
                 [Bindable]
                private var dpFlat:ArrayCollection = new ArrayCollection([
                                     {JobName:"A"},
                                    {JobName:"B"}, 
                                    {JobName:"C"},
                                    {JobName:"D"}, 
                                    {JobName:"E"},
                                    {JobName:"F"},
                                    {JobName:"G"}]);
                  private function box_addChild():void
                        var box:HBox = new HBox();
                           box.width=716;
                           var descriptionTextInput:TextInput = new TextInput();
                           var strButton:Button=new Button();
                          strButton.label="Submit";
                         descriptionTextInput.width=174;
                         descriptionTextInput.height=58;
                         box.addChild(descriptionTextInput);
                        /*     box.addChild(strButton); */
                        //    strButton.addEventListener(MouseEvent.CLICK,submitButtonClicked);
                         interactiveQuestionsVBoxID.addChild(box);
          public function init():void
            this.addEventListener( DragEvent.DRAG_ENTER, acceptDrop );
            this.addEventListener( DragEvent.DRAG_DROP, handleDrop );
          public function acceptDrop( dragEvent:DragEvent ):void
            if (dragEvent.dragSource.hasFormat("items"))
              DragManager.showFeedback( DragManager.COPY );
              DragManager.acceptDragDrop(TextInput(dragEvent.currentTarget));
          var pt:Point;
          public function handleDrop( dragEvent:DragEvent ):void
           // var dragInitiator:UIComponent = dragEvent.dragInitiator;
            //var dropTarget:UIComponent = dragEvent.currentTarget as UIComponent;
            var items:Array  = dragEvent.dragSource.dataForFormat("items") as Array;
            /* pt = new Point(dragEvent.localX, dragEvent.localY);
            pt = dragEvent.target.localToContent(pt);
            var img:TextInput = new TextInput();
              img.x=dragEvent.localX;   img.y=dragEvent.localY;
           // img.x=pt.x - Number(dragEvent.dragSource.dataForFormat("mouseX"));
              //img.y=pt.y - Number(dragEvent.dragSource.dataForFormat("mouseY"));
            img.width = 50;
            img.height=50;
            img.setStyle("fontSize",20);     // img.source="assets/" + items[0].id + ".png";
            img.text=items[0].JobName.toString();
             img.buttonMode = true;
             img.mouseChildren = false;
              TextInput(event.currentTarget).text=itemsArray[0].label;
             var itemsArray:Array = event.dragSource.dataForFormat("items") as Array; */
                    TextInput(dragEvent.currentTarget).text=items[0].label;
             public function beginDrag( mouseEvent:MouseEvent ):void
            var dragInitiator:TextInput = mouseEvent.currentTarget as TextInput;
            var dragSource:DragSource = new DragSource();
           // dsource.addData(this, 'node');
            dragSource.addData(this.mouseX, 'mouseX');
            dragSource.addData(this.mouseY, 'mouseY');
            //parent.addChild(dragImg);
            //dragSource.addData(mouseEvent.currentTarget.text, "txt");
            try{
                var dragProxy:TextInput=new TextInput();
                dragProxy.text = mouseEvent.currentTarget.text;
                   // Alert.show("Text isss"+dragProxy.text);
                   dragProxy.setActualSize(mouseEvent.currentTarget.width,mouseEvent.currentTarget .height)
                // ask the DragManger to begin the drag
                DragManager.doDrag( dragInitiator, dragSource, mouseEvent, dragProxy );
            catch(e){}   
                  ]]>
        </mx:Script>
    <mx:Canvas id="c1" width="100%" height="100%" y="10" x="10" >
    <mx:DataGrid id="d1" dataProvider="{dpFlat}"  x="10" y="119" dragEnabled="true"   dragMoveEnabled="true"  height="229" width="176"/>
    <!--<mx:Label id="lbl"   text="Job Name" width="195" height="28"  x="0" y="0" fontWeight="bold"/>-->
    <mx:Box id="questionLabelMode" direction="horizontal" width="270.5" height="24" y="76" x="211">
        <mx:Label name="Answer" width="173" text="Answer" fontWeight="bold"/>
        <mx:Button label="+" width="70" click="box_addChild();" fontWeight="normal"/>
        <!--<mx:Button label="-" width="71" fontWeight="bold" click="box_deleteChild();"/>-->
    </mx:Box>
    <mx:VBox id="interactiveQuestionsVBoxID" y="119"  height="100%" width="270.5" horizontalScrollPolicy="off" x="211">
                     <!--<mx:Box id="boxID" direction="horizontal" width="268" height="58">-->
                         <mx:TextInput id="t1" width="174" dragDrop="handleDrop(event)"    height="58"/>
                         <!--<mx:Button label="Submit" id="b1" />-->
                  <!--    </mx:Box>-->
    </mx:VBox>
            </mx:Canvas>
    </mx:Application>

    Hi Satya,
    I have done it for you ...please copy the below whole code and try to run the application. You can see the application working for you.
    You have done two mistakes --- you have added the event listeners on this object........but this refers to current object(i.e; your main application file but not TextInput).
    So you need to addEventListeners for your textinput "t1" but not to this...
    If you add the listeners on this then in your "acceptDrop" and "handleDrop" functions you will get the "dragEvent.currentTarget" as your main app but not TextInput(Since you have added listeners to "this "). If you addListeners on t1 then its correct.
    Also you need to add the eventListeners for the newly added textboxes as I done in "box_addChild" function in below code.
    Also in the handleDrop function the line of code where you are assigning the text is wrong ......it should be the below code...
    TextInput(dragEvent.currentTarget).text=items[0].JobName;
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"   width="100%"  height="100%" creationComplete="init()">
    <mx:Script> 
      <![CDATA[
                    import mx.containers.HBox;
                    import mx.controls.Alert;
                    import mx.managers.PopUpManager;
                //    import Components.testPopUpWindow;
                    import mx.core.UIComponent;
                    import mx.containers.TitleWindow;
                    import mx.core.DragSource;
                   // import mx.core.IUIComponent;
                    import mx.managers.DragManager;
                    import mx.events.DragEvent;
                    import mx.controls.Alert;
                    import mx.controls.Text;
                    import flash.geom.Point;
               import mx.collections.ArrayCollection;
               [Bindable]
               private var dpFlat:ArrayCollection = new ArrayCollection([
                                     {JobName:"A"},
                                    {JobName:"B"}, 
                                    {JobName:"C"},
                                    {JobName:"D"}, 
                                    {JobName:"E"},
                                    {JobName:"F"},
                                    {JobName:"G"}]);
                private function box_addChild():void
                    var box:HBox = new HBox();
                    box.width=716;
                    var descriptionTextInput:TextInput = new TextInput();
                    var strButton:Button=new Button();
                    strButton.label="Submit";
                    descriptionTextInput.width=174;
                    descriptionTextInput.height=58;
                    descriptionTextInput.addEventListener( DragEvent.DRAG_ENTER, acceptDrop );
           descriptionTextInput.addEventListener( DragEvent.DRAG_DROP, handleDrop );
                     box.addChild(descriptionTextInput);
                    /*     box.addChild(strButton); */
                    //    strButton.addEventListener(MouseEvent.CLICK,submitButtonClicked);
                     interactiveQuestionsVBoxID.addChild(box);
    public function init():void
         t1.addEventListener( DragEvent.DRAG_ENTER, acceptDrop );
         t1.addEventListener( DragEvent.DRAG_DROP, handleDrop );
          public function acceptDrop( dragEvent:DragEvent ):void
            if (dragEvent.dragSource.hasFormat("items"))
              DragManager.showFeedback( DragManager.COPY );
              DragManager.acceptDragDrop(TextInput(dragEvent.currentTarget));
          private var pt:Point;
          public function handleDrop( dragEvent:DragEvent ):void
           // var dragInitiator:UIComponent = dragEvent.dragInitiator;
            //var dropTarget:UIComponent = dragEvent.currentTarget as UIComponent;
            var items:Array  = dragEvent.dragSource.dataForFormat("items") as Array;
            /* pt = new Point(dragEvent.localX, dragEvent.localY);
            pt = dragEvent.target.localToContent(pt);
            var img:TextInput = new TextInput();
              img.x=dragEvent.localX;   img.y=dragEvent.localY;
           // img.x=pt.x - Number(dragEvent.dragSource.dataForFormat("mouseX"));
              //img.y=pt.y - Number(dragEvent.dragSource.dataForFormat("mouseY"));
            img.width = 50;
            img.height=50;
            img.setStyle("fontSize",20);     // img.source="assets/" + items[0].id + ".png";
            img.text=items[0].JobName.toString();
             img.buttonMode = true;
             img.mouseChildren = false;
              TextInput(event.currentTarget).text=itemsArray[0].label;
             var itemsArray:Array = event.dragSource.dataForFormat("items") as Array; */
              var currTarget:* = dragEvent.currentTarget;
              //interactiveQuestionsVBoxID = currTarget.getChildByName("interactiveQuestionsVBoxID");
                TextInput(dragEvent.currentTarget).text=items[0].JobName;
          public function beginDrag( mouseEvent:MouseEvent ):void
            var dragInitiator:TextInput = mouseEvent.currentTarget as TextInput;
            var dragSource:DragSource = new DragSource();
           // dsource.addData(this, 'node');
            dragSource.addData(this.mouseX, 'mouseX');
            dragSource.addData(this.mouseY, 'mouseY');
            //parent.addChild(dragImg);
            //dragSource.addData(mouseEvent.currentTarget.text, "txt");
            try{
                var dragProxy:TextInput=new TextInput();
                dragProxy.text = mouseEvent.currentTarget.text;
                   // Alert.show("Text isss"+dragProxy.text);
                   dragProxy.setActualSize(mouseEvent.currentTarget.width,mouseEvent.currentTarget .height)
                // ask the DragManger to begin the drag
                DragManager.doDrag( dragInitiator, dragSource, mouseEvent, dragProxy );
            catch(e:Error){}   
         ]]>
    </mx:Script>
        <mx:Canvas id="c1" width="100%" height="100%" y="10" x="10" >
      <mx:DataGrid id="d1" dataProvider="{dpFlat}"  x="10" y="119" dragEnabled="true"   dragMoveEnabled="true"  height="229" width="176"/>
      <mx:Box id="questionLabelMode" direction="horizontal" width="270.5" height="24" y="76" x="211">
          <mx:Label name="Answer" width="173" text="Answer" fontWeight="bold"/>
          <mx:Button label="+" width="70" click="box_addChild();" fontWeight="normal"/>
      </mx:Box>
      <mx:VBox id="interactiveQuestionsVBoxID" y="119"  height="100%" width="270.5" horizontalScrollPolicy="off" x="211">
        <mx:TextInput id="t1" width="174" dragDrop="handleDrop(event)" height="58"/>                    
      </mx:VBox>
    </mx:Canvas>
    </mx:Application>
    If this post answers your question or helps, please kindly mark it as such.
    Thanks,
    Bhasker Chari

  • How to Pass a String as a MovieClip Name?

    Hi everyone! I'm back with more doubts
    I created 4  buttons with 4 animations each, one for each state (using tweens), so I  have that imense list of 16 "addEventListeners" (don't know if there's  another way to do it). But everything is working as I would like.
    The  problem is that I'm trying to create only 4 functions to take care of  all the 4 buttons and those 16 eventListeners.
    This is  part of my AS3 file (still with the "traces", 5 secs of animation to  check the animations and all).
    empresa_btn.addEventListener(MouseEvent.MOUSE_OVER, isOver);
    empresa_btn.addEventListener(MouseEvent.MOUSE_OUT, isOut);
    empresa_btn.addEventListener(MouseEvent.MOUSE_DOWN, isDown);
    empresa_btn.addEventListener(MouseEvent.MOUSE_UP, isUp);
    parceiros_btn.addEventListener(MouseEvent.MOUSE_OVER, isOver);
    parceiros_btn.addEventListener(MouseEvent.MOUSE_OUT, isOut);
    parceiros_btn.addEventListener(MouseEvent.MOUSE_DOWN, isDown);
    parceiros_btn.addEventListener(MouseEvent.MOUSE_UP, isUp);
    var mouseState:String;
    var mouseActive:String;
    var txt:String;
    empresa_btn.over.alpha = 0; empresa_btn.down.alpha = 0;
    parceiros_btn.over.alpha = 0; parceiros_btn.down.alpha = 0;
    function isOver (e:MouseEvent):void {
         mouseActive = e.currentTarget.name;
         mouseState = "isOver";
         trace (mouseActive + " " + mouseState);
         var isOver:Tween = new Tween(empresa_btn.over, "alpha", Strong.easeOut, empresa_btn.over.alpha, 1, 5, true);
    function isOut (e:MouseEvent):void {
         mouseActive = e.currentTarget.name;
         mouseState = "isOut";
         trace (mouseActive + " " + mouseState);
         var isOut:Tween = new Tween(empresa_btn.over, "alpha", Strong.easeOut, empresa_btn.over.alpha, 0, 5, true);
    Now, what I'm trying to do is use the var "mouseActive"  that is returning the right button names inside the Tween as the  movieClips.
    The problem is that "e.currentTarget.name" is not the  "movieClip" itself... it's just a String with the name of the movieClip.
    Example:  whenever I try to do something like this:
    var isOut:Tween = new Tween(mouseActive.over, "alpha", Strong.easeOut, mouseActive.over.alpha, 0, 5, true);
    It will return an error cause, as I said, mouseActive is not a  movieClip, it's just a String (at least I think).
    I already  thank you for the help (again)
    And please, mind my nickname

    Ned Murphy wrote:
    You're welcome.
    As a further opportunity to reduce code, since all your listeners are identical...
    var btnArray:Array = new Array(btnNames go here, no quotes);
    for(var i:uint=0; i<btnArray.length; i++){
         btnArray[i].addEventListener(...OVER...);
         btnArray[i].addEventListener(...OUT...);
         etc... including where you set alpha = 0
    Gosh Ned! I had about 25 big lines of code, including things like "buttonMode = true" and now I have less than 10
    This is totally crazy! I always tried to understand this array thing and always failed. It's complicated but your code made some sense after a while
    I'm running out of "thanks" to give you hehe. Everything is working just fine but one little thing. I have a sound that plays when a button is clicked. It's working fine but everytime I open the swf the sound autoplay once =/
    I'm using this code:
    var btnSound:Sound = new clickSound(); //"clickSound" is the className I choosed when exported the sound to AS from the library
    and then, inside the function MOUSE_DOWN I have:
    btnSound.play();
    Everything is working but I always hear the button sound playing one time when I open the swf. Do you know why?
    Well, you already helped me a lot. Even more that I could have asked for.
    Thanks!

  • HTML5 Canvas: Removing EventListeners

    Hey guys
    I'm working on a project using the HTML5 canvas - quite simply, I have a 5x5 grid of squares that disappear when you click on them.
    Adding the listeners is fairly straightforward, I'm using the following code:
    var begin = addEventListeners.bind(this);
    var finish = removeEventListeners.bind(this);
    function addEventListeners()
      for (var i = 1; i < 26; i++)
      this["square"+i].addEventListener('click', squareClicked.bind(this["square"+i]));
    begin();
    This works just fine, there's a function called squareClicked that hides the square.
    The problem comes when I try to remove a listener, I've tried this:
    function removeEventListeners()
      for (var i = 1; i < 26; i++)
      this["square"+i].removeEventListener("click", squareClicked.bind(this["square"+i]));
    But no luck at all, I'm stumped, how would I go about doing this?
    Thanks

    Yes, I already pointed out in the first post that you can change the compression at the individual asset level and that there doesn't seem to be any way to change it in the publish dialog.
    Seems a bit absurd that the ability to change the default compression got left out of HTML5 mode. This has been core Flash functionality since pretty much forever.

  • EventListeners class

    Hello All, I am learning ActionScript 3.0 A simple question for you. In my Actions panel. I am trying to get a video feed from the Camera. How do i you use addEventListeners to see if the feed is successfull or unsuccessfull?

    copy and paste the code you are using to retrieve the feed.

  • Multiple images (thumbnails) and the Mediaplayer

    I confused about how to approach the concept of OSMF's Mediaplayer
    working with something like a scrolling list of thumbnail images.
    I understand that you can have multiple instances of the Mediaplayer,
    but how do you work with the addEventListeners?
    Do you store the instances, inside an Array or ArrayCollection?
    I can't find any online docs or code that helps me understand this use case.
    I would appreciate any advice.

    I may be asking for something OSMF was never intended to do and maybe I should not be thinking of building playlists using OSMF at all.
    I want to create some kind of Playlist that has a image  (scrolling list, cover flow, etc...).
    I was assuming that the image inside this playlist could be displayed using an MediaPlayer/ImageElement. This palylist does not need to use SerialElement or ParallelElements in this case, I think.
    While thinking through this I figured I could store an instance of the MediaPlayer in an Array, for each image. Then my thoughts turned to handling all the possible addEventListeners and it seemed like a nightmare. Now, I can do all this normally without MediaPlayers, I guess I'm just seeing how far OSMF can reach.
    To me playlists, in different forms, are companions to a MediaPlayer, right? Even video might need a visual image playlist.
    So I guess my question is, where is a good cut off point for using or not using OSMF for displaying images in an application?
    Has anyone built a visual playlist using OSMF to display an image?

  • How to swap the position of two objects?

    I have four self made componensts that I imported them into my main mxml file
    and placed each on four corners.
    What I want to achieve is to drag each component onto others then swap their position.
    For example, comp A is dragged over comp B, when this is detected, swap the position of A and B.
    But at the moment it doesn't seem to work properly. I could not figure out what's wrong with my code. Could any one help me achieve that?
    Many thanks to any who could give me a hand!
    *********This is one of my component***********
    *********All other three components are made the same way, except each source of image file is different******************
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Box xmlns:mx="http://www.adobe.com/2006/mxml" width="42" height="42">
        <mx:Image source="Images/air.png"/>
    </mx:Box>
    *********This is my mxml that calls my components***********
    <?xml version="1.0" encoding="utf-8"?>
    <mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" xmlns:comp="Comp.*" creationComplete = "onInit()">
        <mx:Script>
            <![CDATA[
                import mx.containers.Box;
                import Comp.Icon_illustrator;
                import Comp.Icon_air;
                import Comp.Icon_flash;
                import Comp.Icon_flex;
                private var i_1:Icon_air; //1
                private var i_2:Icon_flash; //2
                private var i_3:Icon_flex; //3
                private var i_4:Icon_illustrator; //4
                private var origX:Number;
                private var origY:Number;
                private var startObj:String;
                private var icons:Array;
                private var h_1:Box;
                private var h_2:Box;
                private var h_3:Box;
                private var h_4:Box;
                private function onInit():void{
                    //initialise all icons
                    i_1 = new Icon_air();
                    i_2 = new Icon_flash();
                    i_3 = new Icon_flex();
                    i_4 = new Icon_illustrator();
                    i_1.name = "i_1";
                    i_2.name = "i_2";
                    i_3.name = "i_3";
                    i_4.name = "i_4";
                    //populate icon
                    showArea.addChild(i_1);
                    showArea.addChild(i_2);
                    showArea.addChild(i_3);
                    showArea.addChild(i_4);
                    //set x position
                    i_1.x = 100;
                    i_2.x = 200;
                    i_3.x = 100;
                    i_4.x = 0;
                    //set y position
                    i_1.y = 0;
                    i_2.y = 100;
                    i_3.y = 200;
                    i_4.y = 100;
                    icons = [i_1, i_2, i_3, i_4];
                    //addEventListeners
                    for(var i:int=0; i<icons.length; i++){
                        icons[i].addEventListener(MouseEvent.MOUSE_DOWN, moveMe);
                        icons[i].addEventListener(MouseEvent.MOUSE_UP, stopDragMe);
                }//end of onInit
                private function moveMe(e:MouseEvent):void{
                    e.currentTarget.startDrag();   
                    showArea.setChildIndex(DisplayObject(e.currentTarget), 0);
                    origX = e.currentTarget.x;
                    origY = e.currentTarget.y;
                    startObj = e.currentTarget.name;   
                private function stopDragMe(e:MouseEvent):void{
                    if(this[startObj].hitTestObject(icons[1])){
                        trace("hit 2");
                        this[startObj].x = i_2.x;
                        this[startObj].y = i_2.y;
                        i_2.x = origX;
                        i_2.y = origY;
                    }else if(this[startObj].hitTestObject(icons[0])){
                        trace("hit 1");
                        this[startObj].x = i_1.x;
                        this[startObj].y = i_1.y;
                        i_1.x = origX;
                        i_1.y = origY;
                    }else{
                        trace("hit others");
                        this[startObj].x = origX;
                        this[startObj].y = origY;
                    e.currentTarget.stopDrag();
                }//end of stopDragMe
            ]]>
        </mx:Script>
        <mx:Panel id="showArea" width="400" height="300" layout="absolute" backgroundColor="0x999999"/>
    </mx:WindowedApplication>

    Here is a sample of swaping two objects in Flex (not Air)   I believe it is the same.  Take a look at the way the x and y coords are swapped using the dragInitator and the currentTarget object in the dragDropHandler.
    Hope this helps
    <?xml version="1.0" encoding="utf-8"?><mx:Application  xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" xmlns:local="*">
     <mx:Script>
    <![CDATA[
     import mx.containers.Box; 
    import mx.core.UIComponent; 
    import mx.managers.DragManager; 
    import mx.core.DragSource; 
    import mx.events.DragEvent; 
    private var dragProxy:Box= new Box(); 
    public function dragDropHandler(e:DragEvent): void { 
    //These variables are the x and y coords of the objects 
    //the e.dragInitator is the object being dragged 
    //the e.currentTarget is the object being dropped on 
    //First save the x and y coords of each of the objects 
    var xdi:int = e.dragInitiator.x; 
    var ydi:int = e.dragInitiator.y; 
    var xct:int = e.currentTarget.x; 
    var yct:int = e.currentTarget.y; 
    //now switch them around.e.dragInitiator.x = xct;
    e.dragInitiator.y = yct;
    e.currentTarget.x = xdi;
    e.currentTarget.y = ydi;
    public function dragEnterHandler(event:DragEvent):void { 
    DragManager.acceptDragDrop(UIComponent(event.target));
    public function mouseMoveHandler(event:MouseEvent):void { 
    if(event.buttonDown == false) return; 
    var dragInitiator:UIComponent = event.target as UIComponent; 
    var dragSource:DragSource = new DragSource(); 
    dragProxy =
    new Box();dragProxy.width = dragInitiator.width;
    dragProxy.height = dragInitiator.height;
    dragProxy.setStyle(
    "borderStyle","solid")dragProxy.setStyle(
    "borderColor","0x000000")dragProxy.setStyle(
    "backgroundColor","0xc6c6c6"); 
    DragManager.doDrag(dragInitiator, dragSource, event, dragProxy,
    event.localX * -1, event.localY * -1, 1.00);
    ]]>
    </mx:Script>
     <mx:Canvas width="84" height="93" x="23" y="14" borderStyle="
    solid" borderColor="
    #030303" backgroundColor="
    #F83C3C"dragEnter="dragEnterHandler(event)"
    dragDrop="dragDropHandler(event)"
    mouseMove="mouseMoveHandler(event)"
    >
     </mx:Canvas>
     <mx:Canvas width="84" height="93" x="223" y="14" borderStyle="
    solid" borderColor="
    #030303" backgroundColor="
    #C5F83C"dragEnter="dragEnterHandler(event)"
    dragDrop="dragDropHandler(event)"
    mouseMove="mouseMoveHandler(event)"
    >
     </mx:Canvas>
     </mx:Application>

  • Conversion Agent Installation Error(Could Not Create IFCMFramework)

    Hello ,
    When I am installing the conversion Agent from Item field in to my stand alone system which is a XI client.I am getting the following error could you plz guide how to resolve this.
    <b>Internal error logged: Could Not Create IFCMFramework.CFramework Control.
    Error details can be found in the log file.</b>
    java.lang.NullPointerException
    at com.itemfield.cm.ui.wizards.project.ActiveXProjectWizard.addEventListeners(ActiveXProjectWizard.java:24)
    at com.itemfield.cm.ui.wizards.project.ActiveXProjectWizard.<init>(ActiveXProjectWizard.java:20)
    at com.itemfield.cm.ui.wizards.project.CMWizard.init(CMWizard.java:118)
    at org.eclipse.ui.internal.dialogs.WorkbenchWizardNode.getWizard(WorkbenchWizardNode.java:126)
    at org.eclipse.jface.wizard.WizardSelectionPage.getNextPage(WizardSelectionPage.java:96)
    at org.eclipse.jface.wizard.WizardDialog.nextPressed(WizardDialog.java:677)
    at org.eclipse.jface.wizard.WizardDialog.buttonPressed(WizardDialog.java:316)
    at org.eclipse.jface.dialogs.Dialog$1.widgetSelected(Dialog.java:423)
    at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:89)
    at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:81)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:840)
    at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:2022)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1729)
    at org.eclipse.jface.window.Window.runEventLoop(Window.java:583)
    at org.eclipse.jface.window.Window.open(Window.java:563)
    at org.eclipse.ui.actions.NewProjectAction.run(NewProjectAction.java:107)
    at org.eclipse.jface.action.Action.runWithEvent(Action.java:842)
    at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:456)
    at org.eclipse.jface.action.ActionContributionItem.handleWidgetEvent(ActionContributionItem.java:403)
    at org.eclipse.jface.action.ActionContributionItem.access$0(ActionContributionItem.java:397)
    at org.eclipse.jface.action.ActionContributionItem$ActionListener.handleEvent(ActionContributionItem.java:72)
    at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:81)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:840)
    at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:2022)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1729)
    at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1402)
    at org.eclipse.ui.internal.Workbench.run(Workbench.java:1385)
    at org.eclipse.core.internal.boot.InternalBootLoader.run(InternalBootLoader.java:858)
    at org.eclipse.core.boot.BootLoader.run(BootLoader.java:461)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.eclipse.core.launcher.Main.basicRun(Main.java:291)
    at org.eclipse.core.launcher.Main.run(Main.java:747)
    at org.eclipse.core.launcher.Main.main(Main.java:583)

    check this https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/3332. [original link is broken] [original link is broken] [original link is broken] [original link is broken]

  • Having Problems with removing an addEventListener

    Greetings Adobe community,
    Im currently having a problem with my flash assignment,
    I have a:   this.addEventListener(Event.ENTER_FRAME, onPanSpace);
    who is causing errors when I go to the next frame:
    TypeError: Error #1009: Cannot access a property or method of a null object reference.
              at Confabulation_fla::mc2_3/onPanSpace()[Confabulation_fla.mc2_3::frame1:13]
    I would like to remove this addEventListener when I go to the next frame(which is by clicking on a door) but to be honest, I have no clue how.
    So I ask you "How do I remove this addEventListener on my next frame?"
    Kind Regards
    Notnao

    function addTheListeners():void {
         addEventListener(Event.ENTER_FRAME, onPanSpace);
         addEventListener(Event.REMOVED_FROM_STAGE, cleanUp);
    var snelheidNum:Number = 0.5;
    var snelheid:Number = 0;
    var MouseIsLinks:Boolean;
    function onPanSpace(e:Event):void
              var afstand:Number = Math.round(this.x - this.bg1.x);
              var percentage:Number = Math.floor((100 * afstand) / (this.bg1.width - root.stage.stageWidth));
              snelheid = -((root.stage.mouseX - (root.stage.stageWidth / 2))/110)/snelheidNum;
              if(root.stage.mouseX < (root.stage.stageWidth / 2)) { MouseIsLinks = true }
              if(root.stage.mouseX > (root.stage.stageWidth / 2)) { MouseIsLinks = false }
              if( (percentage < (1 - 100) && MouseIsLinks) || (percentage > (80 - 100) && !MouseIsLinks)) {snelheid = 0;}
              this.bg1.x += (snelheid / 1);
    function cleanUp(e:Event):void {
         removeEventListener(Event.ENTER_FRAME, onPanSpace);
         removeEventListener(Event.REMOVED_FROM_STAGE, cleanUp);
    //this.addEventListener(Event.ENTER_FRAME, onPanSpace);
    stop();
    This is what I got now, It removes the addeventListeners and I have no problems at the next frame but now my first frame doesnt have the onPanspace effect.

Maybe you are looking for