A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Crazy AS3 error in trivial code.

  1. #1
    Junior Member
    Join Date
    Nov 2012
    Posts
    10

    Crazy AS3 error in trivial code.

    I'm trying out some ment to be used with Wowza Media Server. I am using Flashdevelop and Flex.

    Here is the code which is an example straight from the Wowza manual (exept for the import statemant):
    =====Main.mxml=====
    Code:
    <?xml version="1.0" encoding="utf-8"?>
    <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                   xmlns:s="library://ns.adobe.com/flex/spark"
                   xmlns:mx="library://ns.adobe.com/flex/mx">
    	<fx:Script source="test.as"/>
    	<fx:Declarations>
    		<!-- Place non-visual elements (e.g., services, value objects) here -->
    	</fx:Declarations>
    	
    </s:Application>
    =====test.as=====
    Code:
    import flash.net.NetConnection;
    
    var nc:NetConnection = new NetConnection();
    var clientObj:Object = new Object();
    
    clientObj.serverToClientMethod = function(param1, param2)
    {
    	return "Hello World";
    }
    
    nc.client = clientObj;
    nc.connect("rtmp://wms.mycompany.com/mymodules");
    I get those errors from this simple code:

    test.as(6): Error: Access of undefined property clientObj.
    test.as(11): Error: Access of undefined property nc.
    test.as(11): Error: Access of undefined property clientObj.
    test.as(12): Error: Access of undefined property nc.

    What is going on here???

  2. #2
    Junior Member
    Join Date
    Nov 2012
    Posts
    10

    An even more simple example

    I have an even more simple example:

    Code:
    var aa:int = 1;
    
    trace(aa);
    The above code works well in flash but not as an external file in flex why??

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center