Systeme D

22 April 2005

ActionScript (or, my brain hurts)

Everything you read about passing variables from HTML/JavaScript to Flash tells you to use FlashVars. This enables you to include variables within the object/embed tags which will then be auto-populated into your SWF when it loads. All very clever.

Except I was doing this, and my movie was crashing every single time. Turns out that even if you have a variable which just contains 123456, Flash interprets it as a string, not a number. Aargh.

Apparently ActionScript MX can do strong typing, which would fix this ('var xcentre:Number=xbase). But the Ming ActionScript compiler doesn't support this. Aargh again.

I eventually hit on a solution: 'var xcentre=Math.floor(xbase)'. Yeah, I know. But it works.

Incidentally, this is a beautifully reliable way of embedding SWFs into your page, and knocks Flash Satay into the proverbial hatted cock.


Comments


Add a comment

Your name:

E-mail address: 

Comment:

your comment. (E-mail addresses will not be visible, but a server-based mail link will be provided.)