I’ve moved!

Hey, I’ve moved! I’ve recently bought my own hosting and of course, I’ll want to host my blog there. ;) Thousands of reasons, so I’m not gonna go into the nitty gritty details. :D

Please check out the continuation of this blog at:
http://blog.flashmech.net

Don’t forget to check out my portfolio site while you’re there!
http://www.flashmech.net

Silly: Loading Text From XML

Made a silly mistake while loading text from an external XML file and I really really don’t want anybody to follow in my footsteps. :P

<strings>
<string id="someString">
<![CDATA[Sentence one\nSentence two]]>
</string>
</strings>

Does the above code looks flawed to you? Take a moment and look it through. :)


When you do the below AS2 codes in flash, what the \n does in the string is basically creating a newline, and thus "Sentence two" will appear below "Sentence one".

var txt:TextField = createTextField( "txt", _root.getNextHighestDepth(), 100, 100, 200, 200 );
txt.text = "Sentence one\nSentence two";

Happily, I ported all these original strings into an XML and got it loaded. What puzzled me was that, when these text were actually loaded, the \n didn’t work! The textfield simply displayed "Sentence one\nSentence two" without the newline. I sought help from a fellow colleague, Arul, and together, we still could not see what’s wrong with it. We left office without solving that "bug".

That night, Arul called to say, "Hey, with CDATA, we don’t need the \n! We simply just need to hit <enter>!" Immediately it struck me, oh ya! That’s the whole idea of using CDATA isn’t it? We got too engrossed with the wrong problem! :D

The next day, I changed all the \n to <enter> key, and expected things to work. Unfortunately though, the text did not turn out as expected. Flash had interpreted my <enter> in XML as double <enter>s when it’s being displayed on the textfield!

I sought Arul’s advice again and this is what I got. Flash interprets <enter> in external text sources as "\r\n", which explains the double <enter>s being rendered. So, what I actually had to do is to run through the string, strips off the "\r", and change it to "" (empty string).

Here’s the code that solves the above issue.
function _processString ( s:String ):String
{
if ( s.indexOf( "\r" ) ) s = s.split("\r").join("");
return s;
}

Hope this helps! ;)

Apollo, Moxie, Frogstar

I have no idea which one I should be more excited about! :D

Adobe Integrated Runtime (AIR)
Codename: Apollo
Name: Adobe Integrated Runtime (AIR)
Info: http://labs.adobe.com/technologies/air/
Description: Adobe® AIR™, formerly code-named Apollo, is a cross-operating system runtime that allows developers to use their existing web development skills to build and deploy rich Internet applications to the desktop.
Download Runtime (Beta) | Download SDK (Beta)

Flex 3
Codename: Moxie
Name: Flex 3
Info: http://labs.adobe.com/technologies/flex/
Description: Adobe® Flex™ 3 is a cross platform, open source framework for creating rich Internet applications that run identically in all major browsers and operating systems.
Download Builder (Beta) | Download SDK (Beta)

Flash Player Update 3
Codename: Frogstar
Name: Flash Player Update 3
Info: http://labs.adobe.com/technologies/flashplayer9/
Description: Adobe® Flash® Player is the high-performance, lightweight, highly expressive client runtime that delivers powerful and consistent user experiences across major operating systems, browsers, mobile phones, and devices.
Download Player (Beta)

Along with the above mentioned series of exciting betas, there’s also a contest going on called Adobe AIR Developer Derby! Read more here!

Lesser Space After Uninstalling CS3 Than Before?

It’s weird, but I need confirmation. Solutions are more than welcome. :)

I’ve installed and uninstalled Adobe CS3 Design Premium twice, and with each uninstall, the size on my hard disk seems to have gone down quite a bit (~600mb). I can’t confirm the actual size because in between the installation I’ve been adding some files on my computer but definitely not ~1.2gb worth.

After each uninstall, I’ll be emptying whatever contents (if any) in my recycle bin, cleaning up the temporary internet folders, and even defragmenting my registry and doing disk clean up. Tried to look into the Program Files folder to find any repository of temporary installation files that might have facilitated the installation, but to no avail. All that couldn’t get me back my lost space.

Anyone experienced this as well?

History Panel in Flash IDE

Ever tried the History Panel in Flash IDE? :)

Even though the history panel made it’s way into Flash since the MX 2004 days, I couldn’t find a good reason to use it. I mean, why would I need an extra panel to clutter up my screen estate when it’s already tough to juggle between the designer and developer related panels? I could easily do a Ctrl-Z(Undo) and Ctrl-Y(Redo) at any time that I want~

Well, times have changed. :D Since I’ve started messing around with JSFL, the history panel becomes the basic tool to learn JSFL commands. Don’t believe me? Follow me through then. ;)

1. In Flash IDE, go to Window –> Other Panels –> History (Ctrl-F10)

History Panel Normal
2. Click on the options button Options Button, under View, you should see a menu as follows:

History Options Dropdown
The Default view that you see, shows the commands in normal layman English that everyone will understand. I have still yet to find any purpose with the Arguments in Panel view, so I’m gonna skip that. The JavaScript in Panel view is what we’re interested with.

3. Here’s the JavaScript in Panel view.

History Panel JavaScript
Did you notice the lines and lines of codes in the history panel now? Well those are JSFL codes! If there’s something that you wish to create for Flash IDE, and have no slightest idea where to begin, yet you know that there’s something similar been done already, you now know where to look!


Further Reads:
Using History and Flash Panels for Faster Development

Follow

Get every new post delivered to your Inbox.