2 Replies Latest reply on Apr 30, 2012 10:40 AM by Flex harUI

    getDefinitionByName in Embedded SWF

    rjoshicool Level 2

      I am using getDefinitionByName to access objects from an embedded SWF in my Flex code. The code is as follows:

       

      [Embed(source='assets/crate.swf', symbol='Item1')]
      private var Item1:Class;
        
      [Embed(source='assets/crate.swf', symbol='Item2')]
      private var Item2:Class;
        
      [Embed(source='assets/crate.swf', symbol='Item3')]
      private var Item3:Class;
      
      .
      .
      .
      .
      
      var cls:Class = getDefinition("Item1") as Class;
      

       

       

      But this gives me Error that: ReferenceError: Error #1065: Variable Item1 is not defined.

       

       

      What is that I am doing wrong here?