So.. It looks like you have some issues with the line moveSketch.target="sketchBox"; ---- since the target is an Object and you are setting it to a String. which is an Object but not the right _type_ of Object. The compiler isn't going to have a spaz but it will surely cause a runtime error. Use moveSketch.target=sketchBox; instead.
Rick Winscot From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED] Sent: Saturday, July 12, 2008 8:38 PM To: [email protected] Subject: [flexcoders] dynamic move In this code I'm dynamically creating an HBox, adding an image to it, adding the box to a Panel, and then creating a Move() to move the Hbox. It produces the error below, which says "value" is not a function. WHAT VALUE? Why doesn't it name the value ? What did I do wrong ? The error comes when I add the final line, moveSketch.play(); var sketchBox:HBox = new HBox(); var sketchImg:Image=new Image; sketchImg.source="Journeysketchsm.gif"; sketchBox.addChild(sketchImg); thePanel.addChildAt(sketchBox,0); var moveSketch:Move = new Move(); moveSketch.target="sketchBox"; moveSketch.xTo=150; moveSketch.duration=3000; moveSketch.play(); TypeError: Error #1006: value is not a function. at mx.effects::EffectInstance/play()[E:\dev\3.0.x\frameworks\projects\framework \src\mx\effects\EffectInstance.as:584] at mx.effects.effectClasses::MoveInstance/play()[E:\dev\3.0.x\frameworks\projec ts\framework\src\mx\effects\effectClasses\MoveInstance.as:230] at mx.effects::EffectInstance/startEffect()[E:\dev\3.0.x\frameworks\projects\fr amework\src\mx\effects\EffectInstance.as:569] at mx.effects::Effect/play()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\ effects\Effect.as:930] at jbh/endEffectHandler()[K:\flex3\src\jbh.mxml:60] at jbh/___jbh_AnimateProperty1_effectEnd()[K:\flex3\src\jbh.mxml:9] at flash.events::EventDispatcher/dispatchEventFunction() at flash.events::EventDispatcher/dispatchEvent() at mx.effects::Effect/effectEndHandler()[E:\dev\3.0.x\frameworks\projects\frame work\src\mx\effects\Effect.as:1329] at flash.events::EventDispatcher/dispatchEventFunction() at flash.events::EventDispatcher/dispatchEvent() at mx.effects::EffectInstance/finishEffect()[E:\dev\3.0.x\frameworks\projects\f ramework\src\mx\effects\EffectInstance.as:651] at mx.effects::EffectInstance/finishRepeat()[E:\dev\3.0.x\frameworks\projects\f ramework\src\mx\effects\EffectInstance.as:690] at mx.effects.effectClasses::TweenEffectInstance/onTweenEnd()[E:\dev\3.0.x\fram eworks\projects\framework\src\mx\effects\effectClasses\TweenEffectInstance.a s:395] at mx.effects::Tween/endTween()[E:\dev\3.0.x\frameworks\projects\framework\src\ mx\effects\Tween.as:524] at mx.effects::Tween/http://www.adobe.com/2006/flex/mx/internal::doInterval()[E :\dev\3.0.x\frameworks\projects\framework\src\mx\effects\Tween.as:565] at mx.effects::Tween$/timerHandler()[E:\dev\3.0.x\frameworks\projects\framework \src\mx\effects\Tween.as:179] at flash.utils::Timer/_timerDispatch() at flash.utils::Timer/tick()

