Elie
Elie

Reputation: 13855

Lingo call to ActionScript not working

I have a Flash sprite in my Director project. Under the Properties of that sprite, under both the Member and the Sprite tabs, it has as its name "Assessment". In my Lingo script, I have the following call:

sprite("Assessment").displayGrade(75, 3, 4)

where displayGrade is a function defined in the Flash object's ActionScript as a method taking 3 numbers as parameters. However, I get an error on this line, and cannot determine why. Am I calling the Flash object's method incorrectly?

Upvotes: 1

Views: 1257

Answers (4)

user3899327
user3899327

Reputation: 1

I have a Flash sprite in my Director project. Under the Properties of that sprite, under both the Member and the Sprite tabs, it has as its name "first". In my Lingo script, I have the following call:

sprite("first").number1

where number1 is a variable defined in the Flash object's ActionScript3 :a=25 in flash. However,in director return , but if swf cteate in ActionScript2 return 25 ! what is syntax in as3 for get variable from flash(swf) inside director (if swf created in as3)?

Upvotes: 0

fenomas
fenomas

Reputation: 11139

I don't know a thing about the Director side, but since this isn't resolved yet I'll ask: how are you doing things on the Flash side?

  • You said your SWF uses AS3, but AS2 and AS3 use completely different engines, so it's very possible that Director can call one but not the other, or that the method differs. Testing with a simple AS2 SWF might help.
  • Where are you defining your function in Flash? If your member Sprite is referring to a SWF, then I'd think you likely want the function to be on the main timeline of the flash file. But if your member Sprite is referring to an actual Sprite in the flash movie, then that wouldn't work, and you would need the function to be defined inside the Sprite (or the class attached to the sprite, perhaps).
  • If there's any doubt about the Flash side, have you tried to call flash methods that are built-in (and hence guaranteed to be present)? If the movie has more than one frame in its top level, you could try calling methods like play(), stop(), or gotoAndStop(n:Number). If there is only one frame then it's not so easy, as most other methods wouldn't have an obvious visual effect.

Apologies in advance if you're already sure the Flash part is okay. These are only guesses.

Upvotes: 2

vyger
vyger

Reputation:

I browsed a little and I found this one:

http://groups.google.com/group/macromedia.director.basics/browse_thread/thread/85203d2879267fe1?pli=1

and this too:

http://dreamweaverforum.info/director/23160-director-11-actionscript-3-a.html

Of course, you should verify by browsing the Director 11 docs.

Regards, Vyger

Upvotes: 3

vyger
vyger

Reputation:

Try this:

set up a container-content reference to your swf, that is the Flash main timeline:

global swfTL
on beginSprite me
swfTL = getvariable(sprite('yourFlashSprite'),'_level0',False)
end

then call

swfTL.displayGrade(75, 3, 4)

Hope it helps.

Upvotes: 1

Related Questions