0 Replies Latest reply on Dec 10, 2009 5:36 AM by drdynscriptbe

    Custom Application Class Embed problem aka AMBIGUOUS

    drdynscriptbe Level 1

      package

       

       

       

       

       

      com.drdynscript.examples

      {

       

      import mx.controls.Image;

       

      import mx.core.Application;

       

      import mx.core.BitmapAsset;

       

       

      import nl.demonsters.debugger.MonsterDebugger;

       

       

      public class FlexTestApp4 extends Application

      {

       

      //EXTERNAL IMAGE

      [

       

      Embed(source="./assets/logo.jpg")]

      [

      Bindable] private var logoClass:Class;

       

       

      //UI COMPONENTS

      [

       

      Bindable] public var imgLogo:Image;

      [

      Bindable] public var imgLogo2:Image;

       

       

      public function FlexTestApp4()

      {

       

      super();

       

      //INITIALIZE

      init();

      }

       

       

      private function init():void

      {

       

       

      //MONSERT DEBUGGER

      MonsterDebugger.

       

      trace(this, "INIT");

      }

       

      public function createImage():void

      {

       

      var imgObj:BitmapAsset = new logoClass() as BitmapAsset;

      imgObj.bitmapData.noise(4);

      imgLogo2.source = imgObj;

      }

      }

      }

       

       

      MY MXML

       

      <?xml version="1.0" encoding="utf-8"?>

      <drdynscript:FlexTestApp4

       

      xmlns:mx="

      http://www.adobe.com/2006/mxml" layout="absolute"

      xmlns:drdynscript="

      com.drdynscript.examples.*">

       

      <mx:Style>

       

      Application

      {

       

      backgroundImage: Embed(source="./assets/District9.png")

       

       

      }

       

      </mx:Style>

       

      <mx:Image x="10" y="10" width="493" height="500" id="imgLogo" source="{logoClass}"/> //DOESNT WORK AMBIGUOUS

       

      <mx:Image id="imgLogo1" source="@Embed(source='./assets/logo.jpg')"/>

       

      <mx:Image id="imgLogo2" creationComplete="createImage()"/>

      </drdynscript:FlexTestApp4>