"Apparently embedding graphics causes a performance hit in compiling, refreshing directories, and even just before launching."
"The easiest solution is to move those embed calls into your style sheet and then compile your style sheet as a module."
http://www.rogue-development.com/blog/index.html
2007. november 6., kedd
2007. október 29., hétfő
Resumable Downloads with AIR
Here is how a sample Request looks like:
In Actionscript we can write a custom header like this:
http://www.richapps.de/?p=113
GET /files/richflv/help/ExportOptions.flv HTTP/1.1
Referer: app-resource:/LoadingTest.swf
x-flash-version: 9,0,60,153
Range: bytes=1200000-1300000
User-Agent: Mozilla/5.0 (Windows; U; en) AppleWebKit/420+ (KHTML, like Gecko) AdobeAIR/1.0
Host: www.richapps.de
In Actionscript we can write a custom header like this:
var header1:URLRequestHeader = new URLRequestHeader("range","bytes="+currentBytesPosition+"-"+toRange);
var re:URLRequest = new URLRequest(downLoadURL);
re.requestHeaders.push(header1);
currentBytesPosition = toRange;
urlStream.load(re);
http://www.richapps.de/?p=113
Async APIs and Callback Functions
"Making the FileStream a member variable is also essential. If the FileStream were instead declared inside someFunction(), it would go out of scope when someFunction() returned and could be garbage collected before the file is read or events are delivered. Many people are surprised by this, but note that the only reference to the FileStream object is the member variable. The FileStream object has references on event listeners, etc. but only references to an object will protect it from collection."
Now, this will almost never happen to you because (a) the garbage collector runs incrementally and it'll take it a while to collect the FileStream object and (b) most file reads will finish and dispatch a complete event long before then. But it can happen, which of course means it'll probably only show up when doing big important demos.
http://blogs.adobe.com/simplicity
"It turns out I was incorrect about this and that some related objects, such as URLStream, are guaranteed to remain live until after they have dispatched a completion event. This behavior is both more useful and more intuitive; after all, it only makes sense that there would be a reference to the URLStream somewhere in the system while it's hanging around receiving data."
http://blogs.adobe.com/simplicity
Now, this will almost never happen to you because (a) the garbage collector runs incrementally and it'll take it a while to collect the FileStream object and (b) most file reads will finish and dispatch a complete event long before then. But it can happen, which of course means it'll probably only show up when doing big important demos.
http://blogs.adobe.com/simplicity
"It turns out I was incorrect about this and that some related objects, such as URLStream, are guaranteed to remain live until after they have dispatched a completion event. This behavior is both more useful and more intuitive; after all, it only makes sense that there would be a reference to the URLStream somewhere in the system while it's hanging around receiving data."
http://blogs.adobe.com/simplicity
2007. október 12., péntek
Using Local Shared Object to store a serialized class instance
Using RemoteClass metadata triggers code gen in in the compilter to ensure that the class is registered with the VM before the application can use it, this includes receiving it from a network request.
http://blog.739saintlouis.com
private function getLSO() :void {
so = SharedObject.getLocal("testData", "/");
var b:ByteArray = (so.data.test as ByteArray)
if(b){
b.position=0;
var o:Object = b.readObject();
test = MyClass(o);
n.text=test.name;
p.text=test.price.toString();
ta.text=test.toString();
}
else{
Alert.show("LSO testData does ot exist!");
}
}
private function setLSO():void {
so = SharedObject.getLocal("testData", "/");
var b:ByteArray = new ByteArray();
b.writeObject(test);
so.data.test=b;
so.flush();
}
http://blog.739saintlouis.com
Címkék:
class,
flex,
instance,
serialize,
sharedobject
Flex Tip - Trigger validation when submitting form
<mx:Array id="validators">
<mx:StringValidator source="{abbreviations}" property="text" required="true"/>
<mx:StringValidator source="{subcode}" property="text" required="true"/>
<mx:StringValidator source="{name}" property="text" required="true"/>
<mx:StringValidator source="{letterType}" property="text" required="true"/>
<mx:StringValidator source="{scheduleType}" property="text" required="true"/>
</mx:Array>
<mx:Button
label="Save"
click="if( Validator.validateAll(validators).length==0 ){ doSave() }"/>
http://www.mikenimer.com
2007. szeptember 27., csütörtök
Using the flash.* classes in MXML
<?xml version="1.0" encoding="utf-8"?>
<!-- http://blog.flexexamples.com/2007/09/26/using-the-flash-classes-in-mxml/ -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:flash.filters="flash.filters.*"
layout="vertical"
verticalAlign="middle"
backgroundColor="white">
<mx:Array id="filterArray">
<flash.filters:DropShadowFilter id="dropShadowFilter"
angle="90"
blurX="5"
blurY="5"
distance="2"
alpha="0.9"
color="0xFF0000" />
<flash.filters:BlurFilter id="blurFilter"
blurX="3"
blurY="3"
quality="3" />
</mx:Array>
<mx:Label text="{flash.system.Capabilities.version}"
fontSize="32"
filters="{filterArray}" />
</mx:Application>
http://blog.flexexamples.com/
Feliratkozás:
Bejegyzések (Atom)