1 Reply Latest reply on Mar 23, 2008 9:11 PM by Celumbra1

    reading child objects in flash content

    Celumbra1
      I have a vector graphic that originated in Illustrator, which I then imported into Flash CS3. I converted the graphic elements to symbols, linking them to AS3 classes, and exported the swf to load into Flex 3.

      I can capture a mouseover event for the individual elements in the graphic, reading the event.target value just fine, loaded via the swfLoader or via the Image tag, and feeding the object to the functions I want to operate on the individual elements.

      Now I want to programmatically (and randomly) select the individual graphic symbols, but can't seem to read them.

      In this sample code, which is not working, "background" holds Flash swf, whether it is a swfLoader, Image, or other Display Object. The underlying symbols are typed as movie clips, but casting the selected children as different types doesn't seem to help.

      public function applyRandom():void

      {
      var index:int = NumberUtilities.random (0, 100, 1);
      var _target:Object;

      _target = Object(background.getChildAt(index));
      animate(_target);
      }

      I've installed Flex Component for Flash CS3 and pulled the individual components into Flex, but not the whole graphic. Even if I re-composed the graphic by moving the individual symbols back into place, in my initial tests, I am running into the same problem.

      Any suggestions would be greatly appreciated.