FlashPlaya

November 22, 2008

ExternalInterface

Filed under: AS 2, AS 3 — Tags: , — iBen @ 4:36 am

So recently I wanted to attempt something without having to ask a javascript developer create a function for me to hit using ExternalInterface, and I’ll be damned to say that Adobe did kept mum on this one.

Knowing that ExternalInterface returns objects, i began to wonder if there was anything on the page that i could tap into from flash.

Turns out that as long as you target what seems to end with a method, viola, you can gain access to almost anything in the html your flash resides in. Basically just have every thing end in toString.

want to know the url Window.location.toString

The possibilities are almost endless. So far the only things I have not been able to do is write to the page or rewrite the SwfObject. but you can get the props of that as well, as long as you know it’s id.

November 15, 2008

Encapsulation

Filed under: OOP — Tags: , — iBen @ 6:33 am

Encapsulation is the process of masking specific methods and properties within a class to prevent any other classes from having to be concerned with what they should not know about such as the implementations of a method or the retrieval of a property.

KEY FEATURES:*
1. Implementation hiding-not just information hiding
2. Exposing only public methods and public attributes
3. Structuring potential change.

November 7, 2008

htmlText+=’shite’

Filed under: AS 2, SourceCode — Tags: , , — iBen @ 6:52 am

A bit of info regarding the TextField in AS2;
When using the Text Tool, a few things are different with respect to the text box vs when created via the createTextField method. The Text tool makes use of the dynamic creation but in a different manner so that its able to be manipulated on the stage in compile time using jsfl which will later take care of the scripting during compile.

A few things regarding the TextField when drawn on stage, html is always true by default. You cant turn it off and it has nothing to do with render as html. When you type into the tf.text what you are doing is providing the tf with unicode to display. When you type tf.htmlText, what you are doing is not only providing unicode, but because htmlText can read ascii, you are telling it to refine, via tags, how it will be displayed. Both have its advantages and disadvantages.

On a recent view of a post http://oddhammer.com/index.php/site/bullets_with_color_in_flash/ displaying a flash anomaly , and on http://enginpost.blogspot.com/2008/02/colored-bullets-in-flash.html, yet another attempt to manipulate htmlText winding in another anomaly, I decided to look into why this is the case.

The thing is that tf.htmlText will work fine the first time text is applied. But when using the tf.htmlText+= feature to concat more tagged text, what happens behind the scenes messes with the currently formated text.
As text is applied in htmlText, if you trace an htmlText field you will see extra tags by default. Note the

in particular. This is what throws off each of these current examples.

What the player does when the += is used on htmlText is it locally holds the regular untagged text in a local variable and then concats the new text, also unapplied in tags, and then re-inserts them into htmlText and tries to complete the tags the best it can.

The way to get around this is one of 2 options: 1 is to never use the += option if you wish to have proper tagging.
or 2nd is to create a string variable and actually concat to that with your html text and then have tf.htmlText= (string variable)

This way you will get the results you desire as seen here: Bullet Test

I have written a wrapper class available for download which will allow you to use your html knowledge to create the text to appear as you wish it. (with regards to what flash can do).

Powered by WordPress