Actionscript 3 Snippets

From Wikicliki
Jump to: navigation, search

Useful AS3 Snippets

Fullscreen

import flash.display.*;

stage.displayState = StageDisplayState.FULL_SCREEN;
stage.scaleMode = StageScaleMode.SHOW_ALL; // SHOW_ALL or NO_SCALE
stage.align = StageAlign.TOP_LEFT;

fscommand("fullscreen", "true");
fscommand("allowscale", "true");

No Cursor

import flash.ui.Mouse;
// Mouse.show(); - optional line
Mouse.hide();


removeChild

	removeChild(video_holder);

will return this error:

	ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.
	at flash.display::DisplayObjectContainer/removeChild()
	at tanah_1920x1080_v5b_fla::gedung_vid_17/closeVideo1()[tanah_1920x1080_v5b_fla.gedung_vid_17::frame1:50]
	at tanah_1920x1080_v5b_fla::MainTimeline/menu_press()[tanah_1920x1080_v5b_fla.MainTimeline::frame1:184]

BUT

	if( container.contains( video_holder) ){ container.removeChild( video_holder ); }

WILL WORK!! BUT I DON'T KNOW WHY?

See Also