Skip to main content
sbryner
Inspiring
July 10, 2009
Question

Tween - cannot create property "y" on string

  • July 10, 2009
  • 1 reply
  • 938 views

Hi,

I'm trying to move mc's around the stage using the Tween class and an Array.

Except this error keeps popping up even when I just try to set the "y" property.

"ReferenceError: Error #1056: Cannot create property y on String.
     at fl.transitions::Tween/setPosition()
     at fl.transitions::Tween/set position()
     at fl.transitions::Tween()
     at vipSlotTournament_fla::MainTimeline/slideUpDown()"

I was trying to use a variable as the mc to move, like so...

// mc name taken from an array (happens even if it's not strict typed)

var myMC:String;

myMc = rankings[0].teamName

firstTweenY=new Tween(myMc,"y",Regular.easeIn,100,200,1,true);

I've also tried just using the array info:

   firstPlaceTweenY=new Tween(rankings[0].teamName,"y",Regular.easeIn,100,200,1,true);

When I just try to move it using:

rankings[0].teamName.y = 200;

I get this error:

"ReferenceError: Error #1056: Cannot create property y on String.
     at vipSlotTournament_fla::MainTimeline/slideUpDown()"

any ideas?

thanks

This topic has been closed for replies.

1 reply

Ned Murphy
Legend
July 10, 2009

You need to use the bracket notation... this[myMC]... in order to have a string interpretted as an object

firstTweenY=new Tween(this[myMc],"y",Regular.easeIn,100,200,1,true);

sbryner
sbrynerAuthor
Inspiring
July 10, 2009

Perfect-a-mundo!

Thanks a bunch you just cured my 2 hour dilema!

thanks.

Ned Murphy
Legend
July 10, 2009

You're welcome