ActionScript 2.0 vs. 3.0 NetConnection

I have a code that I use to connect to a streaming server. This version is compiled to ActionScript 2.0:
----
netConnection = new NetConnection();
netConnection.onStatus = {function (info)}
trace ("status:" + info.code);
};
NetConnection.connect() ("rtmp://server.net/blah/blah/");
----
When I run, I get "status: NetConnection.Connect.Success" and everything works as it should.


Now, I executed what seems to be almost identical, compiled code for ActionScript 3.0:
----
var netConnection:NetConnection = new NetConnection();
netConnection.addEventListener (NetStatusEvent.NET_STATUS, netStatusHandler);
NetConnection.connect() ("rtmp://server.net/blah/blah/");

function netStatusHandler(event:NetStatusEvent):void {}
trace ("status:" + event.info.code);
}
----
When I run that, however, I get:
status: NetConnection.Connect.Rejected
status: NetConnection.Connect.Closed

I tried using port 1935 as suggested here, and which did not help. I also tried this download on my server to see if it was the firewall on my computer. The same problem. I CAN connect using the FLVPlayBack ActionScript 3.0, but I prefer to use this method...

But honestly, the only real difference is the move from AS2.0 to 3.0. What could be different to make the server rejects my connection? Is there any other way, that I'm supposed to connect with 3.0? I found surprisingly little info on the subject.

If it's something on the server itself, please explain slowly with small words. :-) I know nothing about the server itself, do not have access directly and must be able to explain the problem to their administrator.

Try adding this code:

netConnection.objectEncoding = ObjectEncoding.AMF0;

before you connect since it's current FMS 2 encoding encoding.

Tags: Adobe Media Server

Similar Questions

  • How can I get my netconnection.nearID?

    I'm building my first application like this for connecting to stratus;

    MyApp.xmxl

    <? XML version = "1.0" encoding = "utf-8"? >
    "< mx:Application xmlns:mx ="http://www.adobe.com/2006/mxml"layout ="absolute"creationComplete =" connect () ">"
    < mx:Script source = "myapp.as" / >
    < / mx:Application >

    MyApp.As

    ActionScript file
    import flash.events.NetStatusEvent;
    import flash.net.NetConnection;
    to import flash.net.NetStream;

    Import mx.controls.Alert;

    private const StratusAddress:String = "rtmfp://stratus.adobe.com";
    private const DeveloperKey:String = "my developerKey ';
    private var nc:NetConnection;
    private var sendStream:NetStream;
    private var recvStream:NetStream;
    private void connect (): void
    {
    NC = new NetConnection();
    nc.addEventListener (NetStatusEvent.NET_STATUS, netConnectionHandler);
    NC. Connect (StratusAddress + "/" + DeveloperKey);
    }

    private void netConnectionHandler(event:NetStatusEvent):void
    {
    Alert.Show (Event.info.code);
    Alert.Show (NC.nearID);
    }

    I got the message

    NetConnection.Connect.Success

    on this line ~ ~ Alert.show (event.info.code);

    but I can not nc.nearID;

    is there something wrong in my code? or what should I do to get my nc.nearID?

    I took your code as posted and copy-pasted in a Flex project (separate .mxml and .as).  the only changes I made were 1) I used my default Flex SDK (3.4.0 - 9271 MPL) and 2) I replaced my own Stratus developer key for 'my developerKey' in your code.  I then changed the compiler "require Flash version" to 10.0.0 and he ran into my browser (with Flash Player 10,0,42,34).  I had two alert boxes, one with my nearID and the other with "NetConnection.Connect.Success".

    Since you say your netConnectionHandler function stops after sending the first alert box, and later, you indicate that you hurry a third zone of alert after trying to access nc.nearID, the only conclusion is that trying to access nc.nearID is thrown an exception.

    Once you have * rechecked * you run this in Flash Player 10.0 or before, the next step is to determine what exception you get.  You can wrap your nc.nearID access in a try/catch block and if it throws an exception, print what is the exception.  you could also install a Flash Player debug, which should the exception in a print dialog box.  even better would be to run the application in Flex Builder debugger.

    -mike

  • Pause a .flv linked with actionscript

    Hi all.

    Let me start by saying that I am fist-and-before a designer... and a newbie to actionscript.

    I have an external .flv and I just need to be able to pause with an action picture and start upward with another action of image.

    I found a few references to "flvStream.play" through google but I was not able to implement correctly.

    Any help would be greatly appreciated. Thanks in advance.

    Geisen,

    > I have an external .flv and I just need to be able to
    > pause with an action picture and start up with
    > another action of image.

    The most important thing I can share with you is this: think in terms of
    objects. A video FLV, external or not, is a file format that needs a little
    help is displayed. A very common approach is to use the
    Component FLVPlayback (see the components Panel), which includes a number of
    configurable (and optional) 'skins' which allow a break, playing, volume
    control, etc. The FLVPlayback component in this scenario is your object.
    Many people use an asset of the video in the library in collusion with something
    called NetConnection and NetStream, in which case you're dealing with three
    (video, NetConnection, and NetStream) objects that work together. Getting back
    In addition, there are parts of media that provide most of the features
    FLVPlayback instance, whereby the focus of your object (s) changes again.

    In all cases, the objects are defined by what we call classes. Film
    clips are defined by the MovieClip, text fields of the TextField class
    class, FLVPlayback with the FLVPlayback class and so on. Classes define
    objects in the way a recipe sets some kind of cake or an action plan
    defines a type of structure. In ActionScript 2.0 language
    Reference, you will find that most of the classes list one or more of the following
    three topics: (characteristic of the object) properties, methods (things
    the object can do) and events (the object can respond to things). In the
    ActionScript 3.0 Langauge reference (if you have Flash CS3), you will find the
    same format, with the occasional feature. A bird
    See, however, the layout is the same: the objects have certain properties, and
    can do certain things and react in a certain way (to the clicks of button, internal
    timers, etc..) - and it is the combination of these qualities that makes a
    an object given the type it is (for example, text fields is not a calendar, so the)
    Class TextField is silent on the current image in a text field,
    Yet, the two text fields and movie clips have width and height, and both their
    classes of talk as well).

    So... how you are going to pause your FLV videos depends entirely
    on the objects used to display this video. If you are using
    FLVPlayback, you will need to give this component an instance on the stage
    name (see the Properties Inspector, while the component is selected). Instance
    names allow ActionScript speak directly to individual instances of a
    object - this particular left FLVPlayback, for example, rather
    the other top-right.

    Once he has an instance name, you can refer to this name and invoke
    Members of the FLVPlayback class on this instance. If you have given the instance
    myPlayer in the name, you must call FLVPlayback.pause () (the pause method) as
    follows:

    In a keyframe in your scripts layer...
    myPlayer.pause ();

    And it is reactivated, you must call FLVPlayback.play () (the game
    method) to a keyframe later like this:

    myPlayer.play ();

    If you use a combination of a video clip in the library and
    the NetConnection and NetStream classes, you can reference your NetStream
    object by its instance name (this will be the variable that allows you
    instantiate the object) and call NetStream.pause () and so on.

    Here are a few articles in ActionScript 2.0 on the theme:

    http://www.quip.net/blog/2006/Flash/how-to-load-external-video
    http://www.quip.net/blog/2006/Flash/how-to-control-FLV-without-component
    http://www.quip.net/blog/2007/Flash/ActionScript-20/how-to-determine-completion-of-FLV/

    At least, you should get a little more comfortable with the idea of
    classes, objects and their members (properties, methods, and events). If
    you build a movie in ActionScript 3.0, the syntax might change... not
    so much for the quick method calls, but certainly for the management of events. For what
    you have described, even these examples in AS2 should be useful.

    David Stiller
    Co-author, Foundation Flash CS3 for designers
    http://tinyurl.com/2k29mj
    "Luck is the residue of good design."

  • Removal of NetStream/NetConnections if not used

    Hello

    Is it possible to write code that looks to see if a NetConnection and NetStream object exists in the scene and so remove them (or *. close(); or other)? I would like to be able to 'see' these 'invisible' object types to get a better grip on when/how/where these things are created (with marks). It is the same for all of these * .addEventListener I continue to create everywhere in AS3. Is there a way to scroll through each of these 'hidden' in a scene and get some sort of status on them?

    Any ideas would be most appreciated.

    -ropeGun

    LuigiL!

    Thanks again for your help and your insight. After re-reading the section on deleting more closely, I saw that the objects not created dynamically cannot be deleted using the delete command, but rather that they should be cancelled. And your suggestion worked perfectly! Thank you for pushing me in the right direction - much appreciated.

    To the extent where the loop that traverses an entire scene to tell me that the State of all objects - I have generally a good grip on when I give life to objects in my scene and ask them to react accordingly to events, sometimes (for debugging purposes) I would be able to see what is happening behind the scenes. I realize that could be misleading to create such loop of headaches.

    I have a theory in developing you, rothrock, kglad, and. Al. are actually robots with brains of supercomputer (using technology ultra-secret gov ' t I) who works tirelessly to help us mere mortals go down with the ActionScript down. ... I'm right, aren't I? Give me a sign if I'm something here.... Dim the lights of my brief of cabin, or something, if I'm on the right track...

    ;-)

    Thanks again!

    -ropeGun

  • Adobe Flash Player starts suddenly many ActionScript errors on some pages.

    Suddenly, Firefox is having a hard time on the pages of ActionScript, including the Adobe ActionScript reference site. It is a very common:

    TypeError: Error #1009: cannot access a property or method of a null object reference.
    at ZeroClipboard()

    These errors always at least slow down the program to a crawl, and usually just Firefox freezes completely. I use Flash 11.4.402.278 on Windows 7 x 64.

    If that doesn't work in Firefox Safe mode then disable all extensions (Tools > Modules > Extensions) and then try to find out who is causing by allowing an extension at a time until the problem reappears.

    Close and restart Firefox after each change through "file > exit ' (Mac: ' Firefox > leave";) Linux: "file > exit ')

  • Search in subfolders with actionscript

    I want to target files and do specific things for them according to what they call their parent folders. To be more precise, if there are files in the subfolder 'Bad' I want to perform a specific action of photoshop on these files and if there are files in the 'Good' subfolder, perform some other action on them.

    I have a folder structure that looks like this:

    Images (root folder)

    -Holiday

    -Good

    -else.jpeg

    -something.jpeg

    -Bad

    -else.jpeg

    -something.jpeg

    -Party

    -Good

    -else.jpeg

    -something.jpeg

    -Bad

    -else.jpeg

    -something.jpeg

    -No matter what

    -Good

    -else.jpeg

    -something.jpeg

    -Bad

    -else.jpeg

    -something.jpeg

    etc.

    Do you mean "ActionScript"? or "AppleScript"?

    It's pretty trivial to do in AppleScript, if that's what you mean. There are several ways to do that, but here are two options:

    the value topFolder to (choose folder)

    say application 'Finder '.

    set image files to each file of all content of topFolder whose name is "jpg" extension

    Repeat with eachFile in image files

    the value subfolderName to the name of container of eachFile

    If subfolderName is 'Good' then

    -do good things

    else If subfolderName is 'Bad' then

    -do bad things

    end if

    end Repeat

    end say


    Note that using the "entire content" a folder can be notoriously slow, especially for large hierarchies. If this is the case for you in alternate iterates through the folders and files directly:


    the value topFolder to (choose folder)

    say application 'Finder '.

    Repeat with eachFolder in (each folder of topFolder)

    -now eachFolder goes through your 'holiday', 'Party', 'Whatever' list

    -Browse the files 'good '.

    Try

    Repeat with eachFile in folder 'Good' of eachFolder

    -do good things

    end Repeat

    end try

    -now to browse the files of 'bad '.

    Try

    Repeat with eachFile in folder 'Bad' of eachFolder

    -do bad things

    end Repeat

    end try

    end Repeat

    end say

  • System crash when you use Reliance Netconnect USB dongle

    Hello

    Yesterday, I bought a Netconnect Reliance USB dongle.

    When I connect it to my Lenovo IdeaCenter B500, it gets recognized and drivers are installed.

    But when I click on the 'Connect' button on the NetConnect software, my system hangs.

    What happens every time. The blue ramdump is displayed. And I was able to note the following message is displayed:

    IRQL_NOT_LESS_OR_EQUAL

    I also have the ramdump file.

    All the world is facing a similar problem before?

    Any ideas how to proceed on this?

    Kind regards

    Kishore

    Bangalore, India

    Dear customer,

    This is to inform you that your concern has been noted. Please share with us your phone number so that we can reach you. Our team is eager to help you.

    See you soon,.

    RCOMcare

  • Reliance Netconnect + Modem does not connect to the Internet in 2301AX G6

    For the past 15 days, my Reliance Netconnect + modem is usually not able to connect to Internet even the signal bars are full. My HP G6 (Win 8 OS) 2301AX was purchased in February 2013. In a short time after purchase, the laptop faced serious questions of heat, and I had to apply thermal paste to cool the system. Although the modem worked perfectly until the beginning of April, this strange problem began. Only once until I met this problem 2 months before and one day all of a sudden the problem is solved on its own! Release with confidence because what the error msg was "the remote computer did not. To make sure that the server can be reached, please ping the remote computer. "They said that there were network update going on in my community, and it is resolved after a few days. Then I went to the center of the modem service and got the modem checked. No problem, and the modem was perfectly to connect to the Internet at high speed!

    Strager thing is if you hold press the strong modem for awhile, sometimes the modem was connect to the Net, and the speed was great! This was for 1 port USB 2.0 and 2 other USB 3.0 ports. Pen drives, digital camera and smartphones were connection correctly however.

    To solve the problem, I contacted HP and followed their advice "uninstall the USB controller drivers and restart the computer. Nothing happened. Then reinstalled Win 8 and updated all the drivers. Nothing improved. I'm not even where the root of the problem might be. All the USB ports on the laptop can't die just in one year! Help, please.

    Hello world

    Solved problems of network modem connection!  Visited HP service center. They said that this situation occurs because incorrect drivers. They recovered the system partition and reinstalled the operating system. And voila! Everything has returned to normal and the modem has detected on all 3 USBs. Thanks for all the help!

  • SE NetConnection.Call.BadVersion only in Simulator

    I have a small prototype application that pulls a few database on a MySql database via PHP using the ZEND libraries.  It works very well in the AIR on the desktop, but this dialog box is displayed in the Simulator:

    Send failed

    Channel.Connect.Failed error

    NetConnection.Call.BadVersion::url:

    'http://localhost:80/Map-debug/gateway.php '.

    The program is going very well, but does nothing with the data that I tried to recover.  When I watch my c:\XAMPP htdocs directory, I see map-debug/gateway.php here along the coast the swf so I know the desktop AIR properly there.   When I look at the content of the .bar file, I see the gateway.php file in the same directory as the swf file.

    Bright ideas?

    The URL, it tries to connect to is localhost, which is not going to work. The PlayBook is running in VMware and should be considered as a separate computer, it has its own IP address. Your server is obviously not the PlayBook itself.

  • How actionscript / flash apps get compiled for the PlayBook?

    Hello

    When you create a bar file, what exactly? Is my actionscript into native arm assembly using a LLVM as described by Adobe for their implementation of iOS?

    I ask because when I tell people I'm an application using actionscript, they say "Flash?" Why would you use Flash? Adobe gave up on this subject.  I would be like power better understand how actionscript/flex/flash is implemented for applications on the PlayBook, so that better explain to others.

    Thanks for the clarification.

    Your AS3 code compiles into a SWF file that is running on the virtual machine in the AIR runtime.

    From: http://www.adobe.com/devnet/flashplatform/whitepapers/roadmap.html

    "Adobe continues to invest actively in allowing developers to create and deploy Flash based content such as mobile (or office) applications through Adobe AIR."

  • How to implement an ActionBar in Pure ActionScript?

    I want to implement an ActionBar with ActionScript on my request, but all the examples I found on the use of the internet in MXML. Is it possible to do?

    https://developer.BlackBerry.com/Air/beta/APIs/QNX/fuse/UI/ActionBar/ActionBar.html

  • How to create table of controls (Images, buttons) in ActionScript

    Hello!

    Could someone help with ActionScript and Playbook SDK?

    How can I create a two-dimensional array of controls (buttons, images, text fields) in ActionScript?

    And how do I use radio buttons in ActionScript?

    Hey,.

    keys and parts do not have ID like in html and javascript. That being said, its impossible to do it like that. the best approach is to create your own class that extends the LabelButton (or whatever component you need) and have an id property that is implemented. so, you can set a code personal to her. I've implemented what you asked below. You can apply this to other components as well enough to make changes to the class and modify the extension. Here is the code:

    LabelButtonTest.as (main application class):

    package
    {
        import flash.display.Sprite;
        import flash.display.StageAlign;
        import flash.display.StageScaleMode;
        import flash.events.MouseEvent;
    
        [SWF(width="1024", height="600", backgroundColor="#CCCCCC", frameRate="30")]
        public class LabelButtonTest extends Sprite
        {
            private var myButtons:Array;
    
            public function LabelButtonTest()
            {
                super();
    
                // support autoOrients
                stage.align = StageAlign.TOP_LEFT;
                stage.scaleMode = StageScaleMode.NO_SCALE;
    
                /*
                 *  Initialize your array of 2 X N (in our case we will be using 10)
                */
    
                myButtons = new Array(new Array(), new Array());
    
                /*
                 * Now we set up our array, first doing the first row and
                 * set up 10 buttons with their own ID using the constructor
                 * for our custom class CustomLabelButton(ID)
                */
    
                for (var i:int = 0; i < 10; i++)
                {
                    var myBtn:CustomLabelButton = new CustomLabelButton(i);
    
                    myBtn.label = "Button " + i;
                    myBtn.setSize(100, 50);
    
                    myBtn.addEventListener(MouseEvent.CLICK, onClickEvent);
    
                    myButtons[0].push(myBtn);
    
                }
    
                /*
                 * We do the same for the second row of buttons, starting
                 * with 10
                */
    
                for (var i:int = 10; i < 20; i++)
                {
                    var myBtn:CustomLabelButton = new CustomLabelButton(i);
    
                    myBtn.label = "Button " + i;
                    myBtn.setSize(100, 50);
    
                    myBtn.addEventListener(MouseEvent.CLICK, onClickEvent);
    
                    myButtons[1].push(myBtn);
                } 
    
                /*
                 * Finally we cycle through our arrays and add them to our display
                 * this wil produce two rows of 10 buttons going accross
                 * each when clicked will call the funciton onClickEvent and
                 * trace out their ID to the debugger
                */
    
                for (var i:int = 0; i < 10; i++)
                {
                    var myBtn:CustomLabelButton = myButtons[0][i];
                    var xPos:int = (i * 100) + 10;
                    var yPos:int = 10;
    
                    myBtn.setPosition(xPos,yPos);
    
                    addChild(myBtn);
                }
    
                for (var i:int = 0; i < 10; i++)
                {
                    var myBtn:CustomLabelButton = myButtons[1][i];
                    var xPos:int = (i * 100) + 10;
                    var yPos:int = 60;
    
                    myBtn.setPosition(xPos,yPos);
    
                    addChild(myBtn);
                }
    
            }
            public function onClickEvent(e:MouseEvent):void
            {
                /*
                 * Print out ID of the button thats clicked
                */
                trace("the button ID is: " + e.target.id);
            }
        }
    }
    

    CustomLabelButton.as (our custom label with the ID property button class):

    package
    {
        import qnx.ui.buttons.LabelButton;
    
        public class CustomLabelButton extends LabelButton
        {
            private var _id:int;
    
            public function CustomLabelButton(num:int = 0)
            {
                super();
    
                id = num;
    
            }
            public function set id(num:int):void
            {
                _id = num;
            }
            public function get id():int
            {
                return _id;
            }
        }
    }
    

    run the code and see how it works. I hope that's what you're looking for. Good luck!

  • How to: Open a page with ActionScript

    Hey guys,.

    I'm developing my first Flash application for the playbook using Flash CS5 and ActionScript 3.

    I want to open a Web page in the playbook when a button is clicked.

    How it works for the playbook?

    I'll give thumbs up for answers that helped me!

    Thank you

    import flash.net.URLRequest;

    import flash.net.navigateToURL;

    ...

    navigateToURL (new URLRequest ("http://www.google.com' "));

  • AIR ActionScript Extensions

    Hello

    I'm interested in the interaction between an application AIR and C of native applications. The information I've found so far are well described in this book. What the book is missing from my point of view is an example of how to code part C. He talks about some available demo files when developing for television, but these are available only when seen - apparently - a kind of additional license.

    When you install the BlackBerry SDK, I found the file FlashRuntimeExtensions.h (lib) file, which is exactly necessary to develop extensions to the ActionScript. So, no matter who ever done something like this before? Someone at - it demo source files? BlackBerry provides more information on this?

    Thanks in advance

    This has yet to be released to the developer community. Maybe a little later this summer.

  • Read the file from the system of files in Flash with Actionscript

    Hello world. I am in the design phase and want to make sure that what I intend to do is possible. I use Flash CS5 and you want to review the system of the PB, or a folder of music files. Is this possible? If so what part of the Actionscript API should I watch?

    Locate the flash.filesystem stuff, and note that your application must have a blackberry file - tablet.xml so that specifies the permission of "access_shared". The forum for this search should appear many in past messages with details.

Maybe you are looking for