I read then as is usually the case i forget and do it the long way… so for future reference:
Tag Archives: Flash Hacks
Yesterday and today i had a properly strange issue with SwfObject 2.2.
I wrote some simple JS code to look for pre-defined div ids and embed each modular swf for my app in place.
Example html and JS is here:
In a nutshell it worked but took ages to finish the embed. So i banged my head against a wall trying all manner of ways to make the embed load quicker, i also tested all the swfobject methods i could but no difference until i realised that a release-build swf from Flex Builder 3 works as expected but a debug-build doesn’t.
You can see from these identical examples how noticeable the difference is:
How strange is that!
If you’re wondering why i use swfobject.createSwf() instead of swfobject.embedSwf() its because createSwf() gives me a decent reference to my flash object and in turn doesn’t require any addition code to work with ExternalInterface in Internet Explorer.
If i use embedSwf() i have to add a Conditional Script Like This to act as a proxy:
You can see the above as a full example here Bobby Vandersluis SwfObject Example
Bobby has some useful demos of the SwfObject features here SwfObject Test Suite
I hope this helps you out, cause it drove me crazy for a good few hours 😉
Today i stumbled upon a couple of blog posts that made my year!
I love having the ability to visualize stuff, especially audio whether it be a live stream or on demand sound. A couple of features i have played with a lot since the release of ActionScript 3.0 are SoundMixer.ComputeSpectrum() and BitmapData.draw().
I’ve always had a good handle on both (yet i’m still learning) but one thing that drove me absolutely crazy was the lack of documentation specifically regarding to what ComputeSpectrum actually spits out. There have been many experiments, usually followed by bouts of depression and hours of frantic searching looking for something…anything…or anyone who might be in a position to attempt to shed some light on things.
The most unanswerable questions where:
- Why is FFT biased towards low frequencies?
- What frequency band does ByteArray.position = N relate to?
- Are the 256 bands per channel equally spaced?
- How can i correct the data to produce a realistic display?
Well here’s the first step:
Ben Stucki has started to attempt to explain his findings in respect of better understanding ComputeSpectrum Ben Stucki – The Math Behind Flash FFT Results
He also references another blog post What’s In An FFT
Lets just say i’m on this big time…
So this was the article
It shouts about Adobe not doing enough to help protect streaming content. So i read it and laughed while making notes about what Amazon could do to prevent this:
- They could use an encrypted stream via rtmpe or rtmpte (or ssl) instead of the ‘sniffable’ default rtmp and rtmpt protocols which it sounds like what they’re doing…
- They could verify their movie player swf’s…
- They could use a server invoked challenge and response system running on a timer…
- They could check the referrer making the request to the server…
- They could check and validate and restrict ip addresses or domain uri’s…
- They could authorize users from a database and check the validity of each request pre connection…
Confusingly i can’t quite understand why according to the article Amazon continue to stream content even though the user is unable to do anything with it (but only they know why). That to me seems to be talking about progressive FLV’s
Anyway the article mentions Replay Media Catcher
So i downloaded installed and started recording. Then i visited the BBC IPlayer where I started to watch the live BBC News 24 stream.
As expected because it’s an unencrypted rtmp stream Replay Media Catcher (RMC) started to record it. After a few minutes I pressed the stop recording button (In RMC) and noticed that my file kept downloading… Ok so I thought maybe I am making an assumption and stopping the recording doesn’t work as I expected. So I stopped the IPlayer News 24 stream by pressing the stop button in the Flash Player (which I know stops the NetStream and may or may not close the NetConnection to FMS). I look at RMC and see the filesize is still growing and think first up maybe it’s draining the buffer… So I close the IPlayer page and then my browser which is FireFox 3 but it doesn’t stop recording the stream!!! I’ve written this post and it’s still going… oh dear I feel an upgrade coming soon.
[Updated] Ok so RMC has stopped recording all by itself now but it recorded 75Mb.
It’s hard to know if i did anything to stop it or whether it experienced an error. It certainly tells me something occured:
Sorry, could only download a partial RTMP stream
Media was saved anyway:
C:\Documents and Settings\User\My Documents\My Recordings\news_channel_1@s2677_F46D3481.flv
m_nErrType = 6
m_strDesc = “recv() failed on timeout – Saved media to file anyway”
m_strFile = F:\proj32\TestRTMPClient\RTMPStreamRip.cpp
m_nLineNumber = 699
…So this leaves at least one question; does it actually use my browser once the recording starts???
Sending a class from Flash Actionscript 3 to Flash Media Server 3 and accessing/editing/updating private variables on the server side!
In this example we have a client side class MyClass which contains public properties and importantly a private property accessed by a public getter and setter.
We create an instance on the client side send it down the wire via our NetConnection to Flash Media Server 3 (FMS3).
FMS3 then changes the public and private properties and returns the instance plus a totally new one back to our client where they both get deserialized and correctly instantiated… Wicked!
Here’s a zipped up solution for anyone interested: example files
Here’s something i created in Flash CS3 which was supposed to be the beginnings of a new AS3 website. During development i encountered some problems preloading external classes exported after frame 1. Unable to find a solution to fix my application i hacked out the example shown below. It works great but i would like to get some feedback from the community to see what you think. If it’s a bad way of doing things please tell me.
Download the original files here to see what i did. [UPDATED SOURCE 240908] Added comments to com.strangeloopstudios.main.Site (which is the document class) to further expain the hack.
Here is an update for Ian to illustrate how i added a button to the application. [NOT UPDATED]