views:

403

answers:

1

Hi,

I'm trying to reuse effects. To achieve this, i was hoping that i could bind some of the effect's properties to the effect's target. Here's what i wanted to do:

<mx:transitions>
   <mx:Transition toState="Ready">
      <mx:Parallel targets="{[b1, b2, b3]}" perElementOffset="200" duration="500">
          <mx:Move xFrom="{target.x-100}" xBy="100">
          <!-- possibly a fade effect too -->
      </mx:Parellel>
   </mx:Transition>
</mx:transitions>
<mx:VBox>
   <mx:Button id="b1"/>
   <mx:Button id="b2"/>
   <mx:Button id="b3"/>
</mx:VBox>

The above code assumes, a state change on application createComplete to Ready state.

In my futile attempt with the above code, i tried to create 1 effect that would animate the entrance of 3 buttons all laid out using VBox. I'm (trying to) avoiding 2 things:

  • Absolute layout hence hand coded coordinates. I want to exploit the containers.
  • Effect code duplication

Results: - Compiler complains target is not defined. I've tried to put whole list of ideas into that field but to no avail. I've tried:

  • {this.target.x}
  • {effectId.target.x}
  • {propertyThatReturnsTheObject.x}

Can this be done? Thanks in advance.

A: 

if you give the Move Effect an id, can you bind to {moveId.target}. Its not clear that your second case is it...

I suspect the compiler is looking for target in a different scope to the one you think it is...

Certainly, target isn't a bindable attribute, so this may be academic anyway.

Gregor Kiddie
I think moveId.target would be null at that time.
Amarghosh
Yes, tried {moveId.target}, it doesn't work. The compiler gives the "Data Binding will not be able to detect assignments to target"Let me see if i can store effects and transitions as resource (like in WPF). Will post back...
Colossal Paul