Sunday, June 24, 2007

3rdParty.libraries

as3httpclient - extend HTTP/HTTPS API (Abdul Qabiz)
israfil-mojo - Maven 2 plugin (Israfil Consulting Services)
xpath-as3 - XPath (Peter Hall)
as3-rpclib - an RPC library (akeemphilbert)
flexlib - Component Library (Adobe People)
as3corelib - Utility Library (Adobe People) *May be integrated into flex 3
ASwing - GUI Framework (Team)
adobe-php-sdk - (Mike Potter - Adobe, et al)
as3flexunitlib - Unit Testing Framework (Adobe)
as3xmpp - XMPP Library (Daniel Dura)

Sites:
http://www.riaforge.org
http://osflash.org

Sunday, May 27, 2007

metadata.Embed

General Properties:
_column
_file
_line
_pathsep
_resolvedSource
exportSymbol (name given to symbol which can be referenced your app?)
mimeType (Documented)
source (Documented)
symbol (Documented)

metadata.Deprecated

Deprecated appears to function the same way as Exclude/ExcludeClass. Adding the Deprecated tag to a class, method, or property removes the item from the asdocs. It also removes the item from the Content Assist of FlexBuilder although it can still be used if manually typed. I expected the compiler to throw a warning telling me that I was using a deprecated function, but I could not get this to occur.

Based on what I've found, I'd expect the tag to be used in one of the following ways:

[Deprecated] // no additional data
[Deprecated("This use is Deprecated")] // a message to display with the warning
[Deprecated(replacement="Use function x instead")] // identification of item that replaced deprecated item

Sunday, May 20, 2007

mx.rpc.soap.WebService.ActionScriptExample

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" applicationComplete="creationApplicationListener(event)">
   <mx:Script>
      <![CDATA[
         import mx.events.FlexEvent;
         import mx.rpc.events.FaultEvent;
         import mx.rpc.events.ResultEvent;
         import mx.rpc.soap.LoadEvent;
         import mx.rpc.soap.WebService;

         public var _webService:WebService; // web service
         public var _webServiceLoaded:Boolean = false; // flag noting when wsdl has been loaded

         public function initWebService():void {
            // initializes webservice
            if (!_webService) {
               _webService = new WebService();

               // assign wsdl url
               _webService.wsdl = "http://www.domain.com/HelloWorld/Service.asmx?WSDL"; // replace this url

               // add listeners
               _webService.addEventListener(LoadEvent.LOAD, load_listener);
               _webService.addEventListener(ResultEvent.RESULT, result_listener);
               _webService.addEventListener(FaultEvent.FAULT, fault_listener);

               // load wsdl
               _webService.loadWSDL();
            }
         }

         public function callHelloWorld():void {
            initWebService(); // init webservice
            if (_webServiceLoaded) { // is wsdl is loaded
               _webService.HelloWorld(); // call web service method called "HelloWorld" with no parameters
            } else { // else
               callLater(callHelloWorld); // wait a frame and try again
            }
         }

         public function load_listener(event:LoadEvent):void {
            _webServiceLoaded = true; // mark wsdl as loaded so we know we can use the web service
         }

         public function result_listener(event:ResultEvent):void {
            trace(event.result); // traces result of webservice method which in this example is "Hello World";
         }

         public function fault_listener(event:FaultEvent):void {
            trace(event.fault); // traces information about failure
         }

         public function creationApplicationListener(event:FlexEvent):void {
            // once application is loaded, call web service
            callHelloWorld();
         }

      ]]>
   </mx:Script>
</mx:Application>

Monday, May 14, 2007

FAQ.limitations

flash.display.BitmapData has a a 2880 limitation on both its width and height. (LiveDocs Reference)

Children of the flash.dispay.Stage (and there are unconfirmed reports that children of all all flash.display.DisplayObjectContainers) have a minimum/maximum x/y value of +/-8191. Exceeding this limitation causes the child to not be displayed. (Reference)

"The minimum swf is about 135." I'm guessing this is for a Flash swf and not a flex swf. (Reference)

The maximum upload/download file size officially supported by FileReference is 100 MB (LiveDocs). It has been widely reported that Flex/Flash unofficially will allow much larger file sizes without any problem.

Saturday, May 12, 2007

toplevel.XML.toString()

The short version: If the XML node is a simple text node, the text of the node is returned. Otherwise the entire node is returned as a String. To always return the entire node, use XML.toXMLString().

The long version: check XML.toString() on the livedocs.

toplevel.XML.Traversing XML structures

I have found Adobe's documentation on "Traversing XML Structures" to cause a little confusion. Nothing Adobe says is wrong. There aren't any features that they've hidden from you. But if you only read parts of the documentation you can get confused fairly easily.

Confusion can be boiled down to one concept in the "Accessing parent and child nodes" substopic. To paraphrase, if you have the variable:

var myXML:XML = <order><book><title>Dictionary</title></book></order>;

since there is only one book tag and that book tag has only one child, you don't have to use indexes when traversing the XML. In other words, you can use either of the following:

myXML.book[0].title[0];
myXML.book.title;


Well it depends on how you are using the variables. The top statement returns an object of XML type. The bottom statement returns an object of XMLList type. This can be important depending on what you are using the result for. For example, let's say you are trying to determine if myXML.book[0] has any title children, you have a few options. Two of them are:

var test1:Boolean = (myXML.book[0].title[0] != null);
var test1:Boolean = (myXML.book[0].title.length() != 0);


Notice that if myXML.book[0] has no children and you try to check that is has children using (myXML.book[0].title != null), the check will always evaluate to true because the left side of the statement will always evaluate to an XMLList even if the XMLList has a length of 0.

This is more important because almost all XML and XMLList functions (such as the attribute (@), decendent (..), etc) work this way and return XMLLists. The only common function that returns an XML object is getting an XML node by index. So if you're having trouble using these function, make sure this confusion isn't what is tripping you up.
"Flex", "ActionScript" and possibly "MXML" are probably trademarks of Adobe Systems Incorporated.
"Adobe" is a trademark of Adobe Systems Incorporated.
This site is in no way endorsed or sponsored by Adobe Systems Incorporated.
Content Copyright © 2007 Daniel Freiman.
Site Design Copyright by its copyright holder.
The Flex Non-Docs reserves the right to remove comments for any reason.
All ActionScript and MXML code (and ONLY ActionScript and MXML code) on this website is available under the MIT License.