0 Replies Latest reply on Jul 27, 2007 7:07 AM by NunoFigueiredo

    where is the problem

    NunoFigueiredo
      hi
      i'm new in flex
      i'm trying to learn by my self, and so far i think i'm going well but i don't understand one thing.
      i had 3 states of a titlewindow and when i do a transition the program skips one state. i will paste the code here if someone can help me please.

      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute" backgroundGradientColors="[#808080, #c0c0c0]">

      <mx:Script>
      <![CDATA[
      import mx.events.CloseEvent;
      import mx.controls.Button;
      import mx.effects.*;
      public function criarmascara(target:Button, bounds:Rectangle):Shape {
      //criar a forma da mascara
      var mascara:Shape = new Shape();
      mascara.graphics.beginFill(0xffffff, 0.7);
      mascara.graphics.drawRect(0,0,289,140);
      mascara.graphics.endFill();
      return mascara;
      }
      ]]>
      </mx:Script>

      <mx:states>
      <mx:State name="lv1">
      <mx:SetStyle target="{panel1}" name="left" value="307"/>
      <mx:RemoveChild target="{linkbutton1}"/>
      <mx:AddChild relativeTo="{panel1}" position="lastChild">
      </mx:AddChild>
      </mx:State>
      <mx:State name="lv2" basedOn="lv1">
      <mx:SetProperty target="{panel1}" name="width" value="707"/>
      <mx:SetProperty target="{panel1}" name="height" value="748"/>
      <mx:AddChild relativeTo="{panel1}" position="lastChild">
      <mx:LinkButton x="597" y="676" label="LinkButton" click="currentState=''"/>
      </mx:AddChild>
      </mx:State>
      <mx:State name="envio1">
      <mx:SetProperty target="{titlewindow1}" name="y" value="461"/>
      <mx:SetProperty target="{titlewindow1}" name="x" value="307"/>
      </mx:State>
      <mx:State name="envio2" basedOn="envio1">
      <mx:SetProperty target="{titlewindow1}" name="y" value="10"/>
      <mx:SetProperty target="{titlewindow1}" name="x" value="307"/>
      </mx:State>
      <mx:State name="envio3" basedOn="envio2">
      <mx:SetProperty target="{titlewindow1}" name="width" value="707"/>
      <mx:SetProperty target="{titlewindow1}" name="height" value="748"/>
      </mx:State>
      </mx:states>

      <mx:transitions>
      <mx:Transition id="transicao" fromState="*" toState="lv2">
      <mx:Sequence>
      <mx:Move duration="1000" target="{panel1}"/>
      <mx:Resize duration="2000" target="{panel1}"/>
      </mx:Sequence>
      </mx:Transition>
      <mx:Transition id="pvoltar" fromState="lv2" toState="*">
      <mx:Sequence>
      <mx:Resize duration="2000" target="{panel1}"/>
      <mx:Move duration="1000" target="{panel1}"/>
      </mx:Sequence>
      </mx:Transition>
      <mx:Transition id="trenvio" fromState="*" toState="envio3">
      <mx:Sequence>
      <mx:Move duration="2000" target="{titlewindow1}"/>
      <mx:Resize duration="2000" target="{titlewindow1}"/>
      </mx:Sequence>
      </mx:Transition>
      </mx:transitions>

      <mx:WipeLeft id="aparecer"
      createMaskFunction="criarmascara"
      showTarget="false"/>

      <mx:TitleWindow width="289" height="140" layout="absolute" title="Contactos" y="610" x="10">
      </mx:TitleWindow>
      <mx:TitleWindow width="289" height="140" layout="absolute" title="Envio de fotos" id="titlewindow1" x="10" y="460">
      <mx:LinkButton x="211" y="78" label="activar" id="btenvio" click="currentState='envio3'"/>
      </mx:TitleWindow>
      <mx:TitleWindow width="289" layout="absolute" title="Clientes" height="140" y="310" x="10">
      </mx:TitleWindow>
      <mx:TitleWindow width="289" layout="absolute" title="Serviços" height="140" y="160" x="10">
      </mx:TitleWindow>
      <mx:TitleWindow width="289" layout="absolute" title="Portfólio" height="140" id="panel1" showCloseButton="true" y="10" x="10">
      <mx:LinkButton x="0" y="0" label="Galeria" width="269" height="100" enabled="true" mouseOver="aparecer" id="linkbutton1" click="currentState='lv2'"/>
      </mx:TitleWindow>
      </mx:Application>

      one other thing how can i make a close button run back the transitions?

      thanks and congratulation for the developers team, what a great program :)