3 Replies Latest reply on Apr 9, 2008 3:26 AM by cxf02

    New to Flex.. sum doubts..


      I have just recently started working wwith flex. The questions might be very basic.
      Could you please help me out.

      A couple of things that i couldn't find :
      1) When we are writing any component, for eg.
      <mx:Label x="17" y="12" text="Tags" mouseDownEffect="WipeLeft" mouseOver=""/>
      From where can I get the list of values which a specific attribute can take.. like mouseDownEffect can take WipeLeft/WipeRight and what else. Similarly for mouseOver, if i want to change the colour of the labe as the mouse goes over it, what values am i supposed to write.

      2) i have been trying to use an HttpService and i want to use an xml file created by me. Forthat, I will need to upload it sumwhere. I tried using it through a local JBOSS server, but i faced difficulties accessing the xml file when given the path as the url.

      3) Also, how do I start with animating objects. Can i use it like flash, where I can rotate or motion tween them.

      Thanks in advance
        • 1. New to Flex.. sum doubts..
          EvolvedDSM Level 2
          Welcome to Flex :)
          1. http://livedocs.adobe.com/flex/3/langref/ is a good source for learning about all the classes and methods. There's a search function available, or you could scroll through the different classes. Yes, this includes your "wipeLeft" class :) The reference doc provides good examples for using the classes or methods as well

          2. Are you developing locally? Why not try to use a relative path for your xml... for insance, let's say you have your XML file (some_file.xml) stored inside your root directory in a folder called assets..... <mx:HTTPService id="srv" url="assets/some_file.xml" result="readXML(event)"/>
          You are simply calling your XML file and passing the method readXML(event) to give your arrayCollection a value.

          You can declare an arrayCollection using...
          private var myArray:ArrayCollection = new ArrayCollection();
          Then you can set your XML as an array...
          private function readXML(event:ResultEvent):void{
          myArray = {event.result.X.Y};
          That will set your array if your XML looked like this...

          3. You should read up on STATES and how you can manipulate your Flex UI with them. There are many good tutorials and examples (I use google for all my flex searches) you can find on the web. As for object animation, you can change the dimensions of objects dynamically through events. It's not quite like Flash though, where you can draw paths for objects to follow or motion tween/shape tween a movie symbol.

          Hope this helped
          • 2. Re: New to Flex.. sum doubts..
            smile_cheese Level 1
            Thanks a lot for the information.
            I am trying to create some animations. There are many .as files but I have not come across any .mxml files along with them which will show me how to call the objects created.
            Is there any place where I can get a sample and a very basic code to move an object, say a circle from left to right and also maybe provide rotation to it.
            That would help me understand the basic concept of animation in Flex.

            Thanks in advance
            • 3. New to Flex.. sum doubts..
              cxf02 Level 1
              Here you go. You'll have to adapt this, but it rotates 4 gears from a central drive gear.

              <?xml version="1.0" encoding="utf-8"?>
              <mx:Canvas xmlns:mx=" http://www.adobe.com/2006/mxml" width="588" height="440" verticalScrollPolicy="off" horizontalScrollPolicy="off" creationComplete="rotate();">
              import mx.events.EffectEvent;
              import mx.effects.Rotate;

              var gears:Array = new Array();

              private function rotate():void {
              var i:int;
              for (i = 0; i < 5; i++) {
              var indice:String = "image"+i;
              var rotate:int = 360;
              gears[indice] = new Rotate();
              gears[indice].target = this.getChildByName("gear"+i);
              gears[indice].originX = gears[indice].target.width * .5;
              gears[indice].originY = gears[indice].target.height * .5;
              gears[indice].duration = 500;
              gears[indice].repeatCount = 10;
              gears[indice].angleFrom = gears[indice].target.rotation;
              if ( i == 0 ) rotate = rotate * -1
              gears[indice].angleTo = gears[indice].target.rotation + rotate;

              gears["image0"].addEventListener("effectStart", showMessage);


              private function showMessage(event:Event):void {
              ad.visible = true;

              private function playGears():void {
              for each (var handle in gears) {


              <mx:Iris id="irisOpen" duration="1000" showTarget="false"/>
              <mx:Iris id="irisClose" duration="1000" showTarget="true"/>

              <mx:Image x="373" y="31" id="gear1" scaleContent="false" autoLoad="true" width="206" height="206" source="assets/mainGear.png"/>
              <mx:Image x="192.3" y="106" id="gear0" source="assets/mainGear.png" scaleContent="false" width="206" height="206"/>
              <mx:Image x="350" y="227" id="gear2" scaleContent="false" autoLoad="true" width="211" height="209" source="assets/mainGear.png"/>
              <mx:Image x="10" y="31" id="gear3" scaleContent="false" autoLoad="true" width="206" height="206" source="assets/mainGear.png"/>
              <mx:Image x="35" y="227" id="gear4" scaleContent="false" autoLoad="true" width="206" height="206" source="assets/mainGear.png"/>
              <mx:TextArea x="10" y="10" visible="false" showEffect="{irisOpen}" hideEffect="{irisClose}" backgroundAlpha="0.5" backgroundColor="#312B2B" wordWrap="true" width="568" height="420" textAlign="center" verticalScrollPolicy="off" horizontalScrollPolicy="off" id="ad">
              <mx:htmlText >
              <![CDATA[<div align="center"><font color="#FFFFFF" face="Arial, Helvetica, sans-serif" size="34" >Is Your Web Business Running Like <br/><b>a<br/> WELL OILED MACHINE?</b></font></div><div align="center"><br/><br/><font color="#CCCCCC" face="Arial, Helvetica, sans-serif" size="34">EVEN IF YOU BELIEVE IT IS </font><br/><br/><br/><font color="#FFFFFF" face="Arial, Helvetica, sans-serif" size="44">IMPROVE IT WITH A</font></div><div align="center"><br/><br/><font size="46" color="#FFFFFF"><b>RICH INTERNET APPLICATION - RIA</b></font></div>]]>