Saturday, December 31, 2011

Flash Builder cannot locate the required debugger version of Adobe Flash Player

When debugs with the flash builder it prompt out the annoying message. Error From Flash Builder 4.5

C:\Windows\System32\Macromed\Flash\NPSWF64_11_1_102.dll Flash Builder cannot locate the required debugger version of Adobe Flash Player. You might need to install the debugger version of the Flash Player or reinstall Flash Builder. Do you want to try to debug with the current version?

    STEP to fix it:
  1. Uninstall Flash Player | Windows
  2. Install back the the debug version
    For google chrome user, you need disable the default plugin flash player in the chrome:plugin.
  1. Go to browser url and type : about:plugin
  2. Disable the flash player version, leave one flash player (debug version) enabled.

Friday, December 30, 2011

Flex 4 : Dynamic Add Images

Dynamic create image using AS3.0 script, each created image will add in the event listener handler.

<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
      xmlns:s="library://ns.adobe.com/flex/spark"
      xmlns:mx="library://ns.adobe.com/flex/mx"
      viewSourceURL="srcview/index.html">
 <fx:Declarations>
  <!-- Place non-visual elements (e.g., services, value objects) here -->
 </fx:Declarations>
 <fx:Script>
  <![CDATA[
   
   import mx.controls.Alert;
   import flash.display.Sprite;
   import mx.controls.Image;
   
   private function handleImageClick(event:Event):void
   {
      // your click handler code
      Alert.show("Click on me!! ID ="+ event.currentTarget.id);
   }
   
   private function createTile():void
   {
      
      var image:Image = new Image();
      image.id = "img_"+tileBox.numChildren;
      image.width = 50;
      image.height = 50;
      image.source = "http://2.bp.blogspot.com/-Z87UUadFXlo/TkDokmzJTDI/AAAAAAAAB20/4ZqPpP8nwdI/s1600/flex.png";
      image.addEventListener(MouseEvent.CLICK, handleImageClick);
      tileBox.addElement(image);

   }
    
   protected function BT_add_clickHandler(event:MouseEvent):void
   {
      // TODO Auto-generated method stub
      createTile();
   }
   
  ]]>
 </fx:Script>
 <s:TileGroup id="tileBox" left="50" right="50" top="50" bottom="50"
     contentBackgroundColor="#D3B4B4" horizontalGap="2" orientation="rows"
     verticalGap="2">
 </s:TileGroup>
 <s:Button id="BT_add" left="50" top="21" label="Add Image" click="BT_add_clickHandler(event)"/>
 <s:Label left="152" top="29" text="Click on image get ID"/>
</s:Application>