0 Replies Latest reply on May 5, 2011 7:34 AM by robadt

    Custom MediaElement with custom complex Layouts

    robadt

      Hello everybody,

       

      i'm trying to implement an custom MediaElement, wich can display custom layouts . Unfortunately, it doesnt work as expected. (I started with the org.osmf.examples.text.TextElement). But instead of the Textfield I'd like to show a custom DisplayObject like labels inside an HBox. But nothing shows up.

      It only works if I'm using just an mx:TextField. Also tried  with spark components

       

      public class HTMLElement extends MediaElement
      {

           public function set text(value:String):void

           {

             if (value != text)
             {
               _text = value;
               updateLayout();
             }
           }
         
           public function get text():String
           {
             return _text;
           }


           private function updateLayout():void
           {
            
      var _hbox:HBox = new HBox();
            
      var _label:Label = new Label();

             _label.text = text;
            
      _hbox.addChild(_label);


             displayObjectTrait = new DisplayObjectTrait(_hbox,500,500);
               
             addTrait(MediaTraitType.DISPLAY_OBJECT, displayObjectTrait);

           }

      }

       

      Maybe you can give me an hint were to find an implementation of such an complex custom component or an hint for showing something that's more complex than juat a Textfield.

      Thank you.