Skip navigation

Monthly Archives: April 2009

Problem #1:
My main FLA file calls in two swfs in two areas of the timeline. SWF1 gets data from an XML file. SWF2 reads a different XML file. I run the main SWF, invoke SWF1, the data looks fine. I go to SWF2, the data is the same data as from SWF1. You who already know the answer, good on you!

I tried unloading the old SWF1. I renamed instance names in SWF2. I renamed variables in SWF2. I thought I was reading the wrong data file. I renamed variables in the XML file. As with all my Flash adventures, I kept butting my head against walls til there was nowhere else to go. I did notice that when I reloaded the main SWF, the problem sort of went away. That’s when I had the glimmer of an idea that it had to do with the cache. Identifying the source of the problem is 9/10’s of the battle.

A google on “preventing xml cache flash” gave me the solution. Thanks to Ziyad at flashden

xml.load(“images.xml?null=” +random(Infinity));

Four hours worth of wall hammering, and one measly statement cured the problem. It only works when the swf is uploaded to the server, and will break when testing locally.

Problem #2:
How do you change the size of a textbox, without the text inside being squished or stretched?
Answer: Click on the box until you get to point of text input (white inner box with handles). Grab the handles then, and not before.

I could use a nap now.


Problem #3:
When is an EQUAL not an EQUAL? when it’s a DOUBLE EQUAL. You Flashy people know EXACTLY what I’m talking about, don’t you? Smarty pants.

In programming languages of old, “If A=B” used to mean “if A equals B”. But not in flash, it don’t mean diddly.

the trace shows true
the trace shows false
If A=False, then do stuff.

It failed to do stuff. WHY? Because Flash need the comparison operator EEEEEQUAL. as in If A==False, not the assignment operator =

Aaargh! That one killed me. That’s what happens when you give a programmer just enough knowledge to royally screw things up.

I got onto yet another tangent. This time it’s tweening tutorials (say that three times fast). Tween tutorials, tween tutorials, tween tututtututoooorials. I’m fine. At first I wanted to learn the parameters for transitions. Here’s the Tweening for Dummies tutorial:

I was spinning my wheels and getting dotted lines, instead of a solid line with an arrow, which tells me that I Tweened incorrectly. The answer is I have to break apart the objects, sometimes I have to break it twice, if I’m tweening text.

I did find a cool tutorial on simulating handwriting.

Played with that for a while, then I finally got on track and went ahead and loaded content into the flash site.

Here’s an interesting quirk. I compiled a flash into a swf. I have a small close button Action. When I mouse over, the Up and Over states are perfect. The button changes color as it should. When I embed the swf into a FLA, and compile that into a swf. The main swf acts odd. In the over state the movie clip/button jumps about a pixel up. I read up on the problem, and tried to “snap to pixels” but that didn’t seem to do the trick. Or maybe I’m not doing it right. In any case, I tried it testing it seven ways to Sunday, and the main swf refuses to behave right. I eventually gave up on it because it’s trivial enough to not really notice, but bugs bug me. I may revisit it later on.

This is like one of those jokes that the Riddler used to leave for the campy TV version of Batman and Robin.

I’ve been playing around with Netstream (the Netstream Method?), for streaming FLVs. When I lift code pieces, I learn just enough of this stuff to do harm and confuse myself silly. Anyway, here’s a cute little netstream statement that reads:


Now, one would assume, that a Pause would mean, Pause the stream. Incidentally, why is a Pause statement attached to the Play button anyway? You boys and girls jumping up and down, who already know the answer — put your hands down and give the other kids in class a chance to participate!

I had two buttons on the movieclip: a play/pause and a Close player. All of them have the ns.pause(); in their respective button click functions.

This is the sequence of my clicking the buttons on my FLV player:
Play – Close. Window closes, clip pauses, sound closes.
Play – Pause. Clip pauses, sound closes.
Play – Pause – Play, perfect.
Pause- Close – BOOM, the window closes, the sound continues. WHUH? Why is it not PAUSEing?

Well, read the clues Sherlock! It’s a fargone toggle! Isn’t hindsight wonderful?
The ns.pause(); has actual parameters as stated in TFManual. Oh, excuse me, the Adobe FManual

So if I actually want to turn the toggle-ness off, and want it to, well — pause, as opposed to pause-resume-pause-resume-etc, I have to tell it


Adobe clearly lists “true” as a parameter, though none of their examples illustrate that exact statement. Maybe they assume that the audience is old enough to figure it out. Or their technical writers were playing games with our heads.

It only took me three days of arduously twisting other parts of the actionscript to figure this out. The former function tester in me was obsessed with fixing this irrational behavior in the movie player. The problem haunted me incessantly. It was a combination of luck and brute force permutations of testing that I even stumbled on the solution.

I think my lesson learned, may be “don’t insert code pieces unless you know exactly what it’s doing.” NAH. I’m sure to repeat that mistake, out of sheer laziness. I’d rather others build the code, and I wedge it in with a sledgehammer.

One interesting thing about Netstream, which I discovered, is that it adds much less code than using Adobe’s built-in UI components, which reportedly add significant bulk to the SWF. Now that splains a lot. The book I learned from, utilizes several UI components. It didn’t mention the resulting file size. As it is, this is a pretty large site. I’ll have to trim something from it.