0 Replies Latest reply on May 7, 2009 10:45 AM by stephan.k

    Flash Library Item with custom class to use in Flex Actionscript project

    stephan.k Level 1

      Hello Forum

       

      I've posted this problem before and have found one complicated workaround:

      http://forums.adobe.com/thread/429555?tstart=0

       

      On another board a member recommended me to look into dynamic classes.  I'm not sure how to use those and if they are the answer to my question.  I have cut down the code to the bare minium to pinpoint the problem.  Error #10009 is thrown at the end of the code.  Please see below:

       

       

      There is one box movieClip in the Flash IDE library containing one bg movieclip instance.>

       

      The problem is creating a custom class called Box which can still access the bg movieClip.  (Error #10009 thrown at the end of the code)

       

       

      Thank you all for your time and help.  I appreciate it!

       

      Cheers

       

      sk


      ---------------------------
      Flash IDE Library:
      ---------------------------
      Properties name: Box
      Export for ActionScript
      Class: Box
      Base Class: MovieClip
      This box MovieClip contains one MovieClip instance called 'bg'

       

      > Export flash movie as assets.swc file for usage in Flex Builder Actionscript 3 project.

       

      ---------------------------
      Box.as
      ---------------------------
      package
      {
          import flash.display.MovieClip;

       

          public dynamic class Box extends MovieClip
          {       
              public function Box()
              {
                  super();           
              }       
          }
      }

       


      ---------------------------
      InheritanceTest.as (Main Application File)
      ---------------------------

       

      package {
          import flash.display.Sprite;
         
         
          public class InheritanceTest extends Sprite
          {
              public function InheritanceTest()
              {
                  var box:Box = new Box();
                  box.bg.alpha = 0.3;    //>> this throws an Error #10009  Cannot access a property or method of a null object reference.
                  addChild(box);
              }
          }
      }