FlashComGuru Home InfluxisCDNImediaseeUvault
                                                                                       Forum Index | Active Topics | Register
                                                                                                          List Overview | List Archives
                                                                                                                           About this site | Advertise
 

home

Adobe AIR (11)
Applications (40)
Books & Training (11)
Collaboration (18)
Components (10)
Events (80)
Flash Player (35)
Flex (39)
FMS (110)
General (123)
Hosting (6)
Jobs (17)
Off topic (36)
OSMF (3)
Press Releases (23)
Site Check (11)
Tools (53)
Videos & Players (74)

Follow me on Twitter

 
I've recently decided that I should post more tips and tricks on this blog. I get a lot of emails and also answer questions on mailing lists that contain information that may be hard to track down (or in the case of email replies impossible) and would be better posted publicly on a blog. Here's one I'd like to start with.

Question: I have been trying to use your tutorial on the NetStream.send function and am getting frustrated. I have been researching this for the past couple of days and not finding any answers.

I am trying to use a button event to have the user recording the video dynamically set a cue point:

nsOut.send("swapPage", thePage);
Then during playback of the video at a later time I am calling this:
ns.swapPage = function(thePage)...
I can't even get this to publish as the compiler gives me the following error:
1119: Access of possibly undefined property swapPage through a reference with static type flash.net:NetStream.
If this is way beyond a simple solution just say so and I'll keep digging on the internet. I was just hoping that with your experience you might see some obvious mistake I am making and be able to help.

My reply to this was:
Your code seems to be AS3.
You can no longer add functions dynamically to NetStream in AS3, therefore this won't work:

nsOut.swapPage = function() [...]
Instead you need to specify a client property (this can be any class/object) for NetStream and then define the function there. For example in your current code you could do:
// whereever you create the NS instance
nsOut = new NetStream(nc);
ns.client = this; // point the client property at 'this' class, the one we are in
then somewhere in the same class:
public function swapPage(params):void
{
// do your thing... }
This should take care of your problem.

Comments
[Add Comment]
nice!
# Posted By bjelmov | 10/29/08 10:57 PM
Well, i trying use .send method of NetSteam but one question, it may works: ns.send("functionName","param1","param2")
into document class ?
# Posted By Pablo Davi | 1/7/09 11:49 AM