The Burned Out Hippy - Hugging Flash into Submission

Flash on the Beach 2011: pre-conference

posted by The Hippy in Events, Musings

Flash on the Beach 2011

So every year I like to double my excitement for Flash on the Beach by preparing my lecture schedule in advance. It’s also really useful to use as reference at the conference itself – to remind me which of the three tracks I preferred when I actually had the time to sit down and read the overviews, and also if you need to find me you’ll know where I’m most likely to be.

So here’s my preferred schedule so far – there’s still a couple of unknowns but it’s looking pretty well rounded already…

More

Post to Twitter Post to Facebook Post to StumbleUpon Post to Digg

Google Chrome, Flash Debugger and Tracing in the browser

Yesterday I was trying to test a fullscreen button on a video player and realised that I couldn’t unless it was inside a browser window. Unfortunately this meant that I would have no way to view traced results, so I installed Vizzy, a browser app that allows you to view flash traces whilst viewing your flash in a browser.

I’ve known about Vizzy for a while, but I’ve previously had no real need for it and when I’ve tried to install it in the past it didn’t seem to work with Chrome (my current browser of choice) so it was uninstalled pretty quickly. But this time I had no choice but to get it working – and as it turns out, the solution was pretty simple… More

Post to Twitter Post to Facebook Post to StumbleUpon Post to Digg

Replacing white space in a string

posted by The Hippy in Actionscript 3, Useful code bits

A handy little tip, if all you need to do is rip out spaces in a string don’t bother with using slice(), use regex instead. Copy the following line of code and replace ‘-’ with whatever you need to replace the space with…

yourString = yourString.replace(/\s+/g, '-');

So for example, if yourString=”blah blah blah”, it will now become “blah-blah-blah”. This is especially useful for amending URLs.

Happy new year!

Post to Twitter Post to Facebook Post to StumbleUpon Post to Digg

Maintaining Aspect Ratio

When manipulating large images for backgrounds or full-screen image galleries, one of the most common problems that I’ve encountered is maintaining the image’s aspect ratio on resize. Especially so if I’m playing with a dynamically fed gallery that contains images of different size ratios.

So here’s the solution to your woes. It’s one that’s worth saving to one side as a “copy and paste solution”. Increase the height of the image (or movieclip) to the size that you want it to be and then apply the following line of script…

(AS3)

mc.scaleX > mc.scaleY ? mc.scaleY = mc.scaleX : mc.scaleX = mc.scaleY;

(AS2)

mc._xscale > mc._yscale ? mc._yscale = mc._xscale : mc._xscale = mc._yscale;

(“mc” of course should be replaced with the target of your image or movieclip)

Hope that helps!

Post to Twitter Post to Facebook Post to StumbleUpon Post to Digg

Converting characters into a URL friendly format

posted by The Hippy in Actionscript 3, Useful code bits

There is a handy command in Actionscript that I’d previously never encountered until this week:

escape()

If you’re receiving a text input and needing to send it out to a URL, for example in a search box, you need to convert any special characters into character codes before you request the URL. For example, a space should be sent as %20.

The escape() command allows you to do this with one command rather than having to search through character by character and reference it to a character codes array.

More

Post to Twitter Post to Facebook Post to StumbleUpon Post to Digg

Recent Posts
Recent Comments
About Us
ronald: I drop a comment when I appreciate a article on a site or I have something to contrib...
Beth: That was AMAZING!! It worked. Thank You!! Thank You!!...
Abel: Thanks a lot.That was the solution i was looking for.It still happens on Flash CS6...
Lorian Rivers: I can view pdf's just fine, but can't get the preview pane to stay locked into a cert...

This site is the playground of the The Burned Out Hippy, head honcho of the web design and multimedia company Plagro. It serves no other purpose than to act as a place where I can store my most recent Flash ActionScript experiments. However, I will be posting code whenever an experiment is complete so that you can have a play with it yourselves.

Read more about The Burned Out Hippy...