[flexcoders] Tempermental URLLoader.load()
Howdy All- PROBLEM: Strange URLLoader.load() behavior: sometimes it works; sometimes it doesn't. Can't step through airglobal.swc to see what's wrong. DETAILS: I am using the latest SDK in several versions of an AIR project. The core code is identical across versions of the project. Most changes are just in the presentation of the data. I am a Cairngorm nut and I have extended it to suit my coding style. I have a master AbstractCommand that addresses everything including listener add/remove, SQLite management, remote services, and File reading/writing. I just override certain functions as needed. In this project I read RSS beginning with the following: override public function execute(event:CairngormEvent):void { trace(LoadFeedCommand.execute() called); var rsso:RSSObject = LoadFeedEvent(event).feedObject; var urlRequest:URLRequest = new URLRequest(rsso.url); loader = new URLLoader(); addListeners(loader); try { loader.load(urlRequest); trace(loader.load() called); } catch(error:Error) { trace(problem with loader.load()); } tModelLocator.displayModel.selectedRSSObject = rsso; } In some of the projects URLLoader.load() works as expected. In others with IDENTICAL code it does not. URLLoader.load() fails into nothingness. The catch clause does not throw an Error. I have added the following listneres in overrided .addListeners() and nothing gets called! override public function addListeners(target:Object):void { target.addEventListener(Event.COMPLETE, onComplete, false, 0, true); target.addEventListener(HTTPStatusEvent.HTTP_RESPONSE_STATUS, onHTTPStatus, false,0, true); target.addEventListener(IOErrorEvent.IO_ERROR, onIOError, false, 0, true); target.addEventListener(Event.OPEN, onOpen, false, 0, true); target.addEventListener(ProgressEvent.PROGRESS, onProgress, false, 0, true); target.addEventListener(SecurityErrorEvent.SECURITY_ERROR, onSecurityError, false, 0, true); } Any insight on this would be wonderful. Thanks, -Naga
[flexcoders] Re: Component controls
Hi Jerry- I use Cairngorm. I would specify a property in a bindable final MyModel like so: public var labelVisible:Boolean; MyModel is then referenced as a property on bindable MyModelLocator (Singleton) like so: public var myModel:MyModel; I then would make my custom component with the following in the script block: fx:Script ![CDATA[ import com.myPackage.MyModelLocator; [Bindalbe] public var myModelLocator:MyModelLocator; ]] /fx:Script So now when I instantiate my custom component I pass in MyModelLocator and then I can then use this variable in the label easily: Label id=myLabel visible={myModelLocator.myModel.labelVisible}/ You should do your processing in a distinct separate AS3 class to manipulate mModelLocator.myModel.labelVisible within that class. Et Viola, the changes percolate prefectly. Hope this sheds some light. -Naga --- In flexcoders@yahoogroups.com, Davidson, Jerry jerry.davidson@... wrote: I want to change the visible property to a control in a component. Where would I do that? It doesn't seem to work in a script tag at the top of the component and I don't know how to reach that control from a script elsewhere. I have an app with an input form (state 1). When you click a button on it, various computations happen and the result form is displayed (state 2). I want to either hide or display a control depending on the data from the computation. It is a label. The value in the text field (bound from a VO) next to it is what I use to make that decision. Jerry
Re: [flexcoders] Tempermental URLLoader.load()
Maybe you are adding listeners to the wrong thing? Because you should get those events when it does work. On 3/24/12 4:00 PM, nagaofthesea nagaofthe...@yahoo.com wrote: Howdy All- PROBLEM: Strange URLLoader.load() behavior: sometimes it works; sometimes it doesn't. Can't step through airglobal.swc to see what's wrong. DETAILS: I am using the latest SDK in several versions of an AIR project. The core code is identical across versions of the project. Most changes are just in the presentation of the data. I am a Cairngorm nut and I have extended it to suit my coding style. I have a master AbstractCommand that addresses everything including listener add/remove, SQLite management, remote services, and File reading/writing. I just override certain functions as needed. In this project I read RSS beginning with the following: override public function execute(event:CairngormEvent):void { trace(LoadFeedCommand.execute() called); var rsso:RSSObject = LoadFeedEvent(event).feedObject; var urlRequest:URLRequest = new URLRequest(rsso.url); loader = new URLLoader(); addListeners(loader); try { loader.load(urlRequest); trace(loader.load() called); } catch(error:Error) { trace(problem with loader.load()); } tModelLocator.displayModel.selectedRSSObject = rsso; } In some of the projects URLLoader.load() works as expected. In others with IDENTICAL code it does not. URLLoader.load() fails into nothingness. The catch clause does not throw an Error. I have added the following listneres in overrided .addListeners() and nothing gets called! override public function addListeners(target:Object):void { target.addEventListener(Event.COMPLETE, onComplete, false, 0, true); target.addEventListener(HTTPStatusEvent.HTTP_RESPONSE_STATUS, onHTTPStatus, false,0, true); target.addEventListener(IOErrorEvent.IO_ERROR, onIOError, false, 0, true); target.addEventListener(Event.OPEN, onOpen, false, 0, true); target.addEventListener(ProgressEvent.PROGRESS, onProgress, false, 0, true); target.addEventListener(SecurityErrorEvent.SECURITY_ERROR, onSecurityError, false, 0, true); } Any insight on this would be wonderful. Thanks, -Naga -- Alex Harui Flex SDK Team Adobe Systems, Inc. http://blogs.adobe.com/aharui