In AS2.0, we had a big issue with the image flickering on dynamic images, In AS 3.0 its easy with the simple codes.
here are the code that you can easily use,
import flash.display.Loader;
import flash.net.URLRequest;
import flash.events.Event;
import flash.display.Bitmap;
var loader:Loader = new Loader()
loader.load(new URLRequest("wiki.jpg"))
addChild(loader);
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, loadCompleted)
function loadCompleted(_event:Event):void
{
var bit:Bitmap = loader.content as Bitmap
bit.smoothing = true
loader.scaleX = loader.scaleY = 1.5
}
Hi,
Here I have given the easiest way to access stage from a class file without using ADDED_TO_STAGE,
We can access the stage by passing a reference of stage in a class file…
Here i have given you a sample code to access….
in AccessStageByReference.as
package{
import flash.display.Stage;
import flash.events.Event;
import flash.events.KeyboardEvent;
public class AccessStageByReference {
private static var initialized:Boolean = false;
public function initialize(stage:Stage) {
if (!initialized) {
// assign listeners for key presses and deactivation of the player
stage.addEventListener(KeyboardEvent.KEY_DOWN, keyPressed);
stage.addEventListener(KeyboardEvent.KEY_UP, keyReleased);
trace(stage)
initialized = true;
}
}
function keyPressed(_event:KeyboardEvent):void{
trace("KeyPressed")
}
function keyReleased(_event:KeyboardEvent):void{
trace("keyReleased")
}
function clearKeys(_event:KeyboardEvent):void{
trace("clearKeys")
}
}
}
you can send a reference for stage into the class by using initialize method..
jujst code like below in the .fla file
var aa:AccessStageByReference = new AccessStageByReference() aa.initialize(stage)
Definitely you need to look at this..
via James Alliban
thanks to adobe…..
String.prototype.between = function(i1, i2)
{
var iA:String = this.indexOf(i1) + i1.length;
if (i1 != i2 && this.indexOf(i1, iA) == -1)
var iB:String = this.indexOf(i2, iA);
else
return this.substring(iA).between(i1, i2);
return this.substring(iA, iB);
};
Array.prototype.remove = function(i) {
this.splice(i, 1);
};
myArray = new Array("0", "1", "2", "3", "4", "5", "6");
myArray.remove(5, 1);
trace(myArray)
myArray.remove(2, 1);
trace(myArray)
myArray.remove(2, 1);
trace(myArray)
/*
0,1,2,3,4,6
0,1,3,4,6
0,1,4,6
*/
Prior to today’s release of the iPhone OS 4 SDK, section 3.3.1 of the iPhone Developer Program License Agreement read, in its entirety:
3.3.1 — Applications may only use Documented APIs in the manner prescribed by Apple and must not use or call any private APIs.
In the new version of the iPhone Developer Program License Agreement released by Apple today (and which developers must agree to before downloading the 4.0 SDK beta), section 3.3.1 now reads:
3.3.1 — Applications may only use Documented APIs in the manner prescribed by Apple and must not use or call any private APIs. Applications must be originally written in Objective-C, C, C++, or JavaScript as executed by the iPhone OS WebKit engine, and only code written in C, C++, and Objective-C may compile and directly link against the Documented APIs (e.g., Applications that link to Documented APIs through an intermediary translation or compatibility layer or tool are prohibited).
My reading of this new language is that cross-compilers, such as the Flash-to-iPhone compiler in Adobe’s upcoming Flash Professional CS5 release, are prohibited. This also bans apps compiled using MonoTouch — a tool that compiles C# and .NET apps to the iPhone. It’s unclear what this means for tools like Titanium and PhoneGap, which let developers write JavaScript code that runs in WebKit inside a native iPhone app wrapper. They might be OK. This tweet from the PhoneGap Twitter account suggests they’re not worried. The folks at Appcelerator realize, though, that they might be out of bounds with Titanium. Ansca’s Corona SDK, which lets you write iPhone apps using Lua, strikes me as out of bounds.
I originally thought this would ban games written using Unity3D, but perhaps not — Unity3D produces a complete Xcode project and Objective-C source files, so it’s more like a pre-processor than a cross-compiler. Hard to tell. If you forced me to bet, though, the fact that developers are writing C# code puts Unity3D on the wrong side of this rule.
There was no mention of this change during the announcement event today, but the language in the agreement doesn’t leave much wiggle room for Flash CS5. It could hardly be more clear if they singled out Flash CS5 by name. (Wonder what Adobe does now? CS5 is thisclose to release and the iPhone compiler is the flagship feature in this version of Flash. They’re pretty much royally fucked.)
I’m not sure how exactly Apple intends to enforce this, but my understanding is that iPhone apps produced by Flash CS5 are easily identifiable as such by inspecting the contents of the app bundle. I’m not sure if there are any “intermediary translation or compatibility layers or tools” which produce app bundles that are indistinguishable from app bundles produced by Xcode and the official SDK.
Update: To be clear, I do not think that Apple is singling out Flash CS5. I do think, though, that Flash CS5’s cross-compiler epitomizes the sort of meta-frameworks Apple is not going to allow. Same goes for MonoTouch. What Apple doesn’t want — and as we see now, is not going to allow — is for anyone other than Apple to define the framework for native iPhone apps. What Apple is saying here is, if you’re going to write a native iPhone app, then you need to target our platform; if you want to do something else, then target the iPhone with an optimized web app. I.e., the iPhone OS supports two software platforms: Cocoa Touch and the web. Apple isn’t going to let anyone else build a meta-platform on top of Cocoa Touch. I think this comment at Hacker News from “raganwald” nails Apple’s perspective on this.
Thanks to Daring Fireball…
| M | T | W | T | F | S | S |
|---|---|---|---|---|---|---|
| « Jan | ||||||
| 1 | 2 | 3 | 4 | 5 | 6 | |
| 7 | 8 | 9 | 10 | 11 | 12 | 13 |
| 14 | 15 | 16 | 17 | 18 | 19 | 20 |
| 21 | 22 | 23 | 24 | 25 | 26 | 27 |
| 28 | 29 | 30 | 31 | |||