1 Reply Latest reply on Sep 27, 2010 6:12 AM by jagguy99

    animation Flex4

    jagguy99 Level 1

      I come from a silverlight background and want to move an

      image loaded at runtime.

       

      In flex I want to use actionscript (not mxml) to load and image and move it across the screen in a game loop (1 px per frame and back again when it reaches end of the screen.

      I am having problems finding this because I find Flash examples and mxml animation class examples.

        • 1. Re: animation Flex4
          jagguy99 Level 1
          undefined Description     
          Access of undefined property onEnterFrame_Animation.     
          Access of undefined property stage.     

           

          here is my whole code

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

          <s:Application

           

          xmlns:fx="http://ns.adobe.com/mxml/2009"

          xmlns:s="

          library://ns.adobe.com/flex/spark"

          xmlns:mx="

          library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600">

          frameRate="30"

           

          creationComplete="CreationComplete()"

           

          enterFrame="EnterFrame(event)">

           

          <fx:Script>

          <![CDATA[

           

          stage.addEventListener(Event.ENTER_FRAME, onEnterFrame_Animation);

           

          public function CreationComplete():void

          {

           

          }

           

           

           

           

           

           

          private function onEnterFrame_Animation(e:Event):void

          {

          addEmployee.x += 1;

           

          if (addEmployee.x >= 400)

          {

          (addEmployee.x = 0);

          }

          }

           

           

           

          ]]>

           

           

          </fx:Script>

           

           

           

           

           

          <s:Button id="addEmployee"

          label="

          Add Employee"

          click="addEmployee_clickHandler (event)"

          />

           

           

           

          </s:Application>