Posted
Filed under Action Script
function closeBtn(e:Event):void {
    var request:URLRequest = new URLRequest("javascript:window.close()");
    navigateToURL(request);

    trace("close");
}
----------------------------------------------------------------------------
function closeBtn(e:Event):void {
    import flash.external.ExternalInterface;
    ExternalInterface.call("window.close","");
}

----------------------------------------------------------------------------
exit_btn.addEventListener(MouseEvent.CLICK,clickButton);

function clickButton(myevent:MouseEvent):void{
   var myurl:String="javascript:self.close()";
    var mywindow:String="self";
   ExternalInterface.call("closewindow",myurl,mywindow);
}

<script language="javascript">
function closewindow (){
self.close();
}
</script>
---------------------------------------------------------------------------------

2010/04/07 20:01 2010/04/07 20:01
Posted
Filed under Action Script
[원문] http://www.flashmorgan.com/index.php/2007/12/20/ondragover-ondragout-and-onreleaseoutside-in-as3/

정확한 내용은 모르겠으나 .. 대충 살펴 보면 actionscript 2.0에서 onReleaseOutSide  사용했었다. 그러면 3.0에서는 api를 살펴보면 onReleaseOutSide 는 존재 하지 않는다.
구글 링 결과...
마우스 다운 이벤트 후 event.curentTarget 에 마우스 업 이벤트를 다시 걸어 준다.
drag area 밖에서 발생한 클릭 이벤트에 대해서는 부모가 반응 하여 동작 하게 된다.
그려면 다시 이벤트 타겟을 비교 하여 체크 할 수 있다.

drag 이벤트 구현중 swf player를 만드는데 응용해 봤다.

public function bar_pointerMouseDown(event:MouseEvent):void{
    drag=true;
    movie.movie.stop();
    event.currentTarget.startDrag(false,myRectangle);
    event.currentTarget.parent.stage.addEventListener(MouseEvent.MOUSE_UP, bar_progressMouseUp);
   }
     
   public function bar_progressMouseUp(event:MouseEvent):void{
   
    if(event.currentTarget!=control_progressbar.bar_pointer){
       trace("release outside");
    }else{
    }
    drag=false;
    control_progressbar.bar_pointer.parent.stage.removeEventListener(MouseEvent.MOUSE_UP,bar_progressMouseUp);
    control_progressbar.bar_pointer.stopDrag();
   }


[원문]

In AS2 there were three mouse events that I used quite often. onDragOver was thrown when the mouse button is selected and the cursor was moved over a MovieClip. This was useful to detect if another object was being dragged over a given clip. onDragOut was the opposite, this event was thrown when the mouse button was selected and the cursor was dragged outside of a given clip. And lastly, onReleaseOutside was thrown when a clip was pressed and the user dragged off the clip before releasing the mouse button. Releasing the mouse outside is a common way for a user to bail out of selecting a button among other reasons.

If you look through the AS3 documentation you will notice there are no MouseEvent.DRAG_OVER, MouseEvent.DRAG_OUT, or MouseEvent.RELEASE_OUTSIDE events. This does not mean that this functionality is not available, it’s just not as obvious. The following code shows how to recreate this functionality in AS3.

var button:Sprite = new Sprite();
button.graphics.beginFill(0x000000, 1);
button.graphics.drawRect(50,50,200,100);
addChild(button);

button.buttonMode = true;
button.addEventListener(MouseEvent.MOUSE_DOWN, buttonPress);
button.addEventListener(MouseEvent.MOUSE_UP, buttonRelease);
button.addEventListener(MouseEvent.MOUSE_OVER, buttonOver);
button.addEventListener(MouseEvent.MOUSE_OUT, buttonOut);

function buttonPress(e:MouseEvent):void {
     //the button is pressed, set a MOUSE_UP event on the button's parent stage
     //to caputre the onReleaseOutside event.
     button.parent.stage.addEventListener(MouseEvent.MOUSE_UP, buttonRelease);
}

function buttonRelease(e:MouseEvent):void {
     //remove the parent stage event listener
     button.parent.stage.removeEventListener(MouseEvent.MOUSE_UP, buttonRelease);

     //if the events currentTarget doesn't equal the button we
     //know the mouse was released outside.
     if (e.currentTarget != button) {
          trace('onReleasedOutside');
     } else {
          //the events currentTarget property equals the button instance therefore
          //the mouse was released over the button.
          trace('onRelease');
     }
}

function buttonOver(e:MouseEvent):void {
     if (e.buttonDown) {
          //if the mouse button is selected when the cursor is
          //over our button trigger the onDragOver functionality
          trace('onDragOver');
     } else {
          //if the mouse button isn't selected trigger the standard
          //onRollOver functionality
          trace('onRollOver');
     }
}

function buttonOut(e:MouseEvent):void {
     if (e.buttonDown) {
          //if the mouse button is selected when the cursor is
          //moves off of our button trigger the onDragOut functionality
          trace('onDragOut');
     } else {
          //if the mouse button isn't selected trigger the standard
          //onRollOut functionality
          trace('onRollOut');
     }
}

So let me explain what is going on here.

To recreate the onDragOver and onDragOut functionality we use the buttonDown property of the MouseEvent. The buttonDown property is a Boolean value that indicates if the users mouse button is selected when the event was triggered. If this property is true we know the user is dragging over or dragging out of the button. If the buttonDown property is false we can trigger our standard rollOver or rollOut functionality.

Recreating the onReleaseOutside functionality is a trickier multi-step process. First we must set up a MouseEvent.MOUSE_DOWN event listener on the button. Secondly we set up a MouseEvent.MOUSE_UP event listener on the same button. Third, in the MouseEvent.MOUSE_DOWN event handler we set up another MouseEvent.MOUSE_UP event listener on the button’s stage that triggers the same event handler as the MouseEvent.MOUSE_UP event handler (buttonRelease) that is set on the button. And lastly we check the currentTarget property of the event passed into the MouseEvent.MOUSE_DOWN event handler to see if it equals the button or the button’s parent stage. If the currentTarget equals the button we know the mouse button was released over the button and we can trigger the onRelease functionality. If the currentTarget property isn’t the button we can assume the user released the mouse button outside of the button. Each situation is different, button.parent.stage may not work in your application, you may have to traverse up the display list, possibly right down to the root child (the Stage) to succesfully detect the onReleaseOutside event. Below I have updated the buttonDown method to show a simple way of traversing up the display list as far as you can go and setting the MouseEvent.MOUSE_UP on the root child.

function buttonPress(e:MouseEvent):void {
     //the button is pressed, set a MOUSE_UP event on the root child in the display list
     //to caputre the onReleaseOutside event.
     var rootChild:DisplayObject = button;
     while (rootChild.parent != null) {
          rootChild = rootChild.parent;
     }
     rootChild.stage.addEventListener(MouseEvent.MOUSE_UP, buttonRelease);
}
2010/03/19 16:48 2010/03/19 16:48
Posted
Filed under Action Script

[원문] - http://www.kirupa.com/forum/showpost.php?p=2108585&postcount=328


play , stop 을 컨트롤 하기 위해서는  별도의 클레스를 만들어서 대리자 역할을 하는 play와 ,stop() 메소드르 ㄹ활용하여 컨트롤 바와 동기화 할 수 있다.
그러나 얼마나 귀찮은 일인가...
action script 3.0에서는 movie를 exteds 하여 재정의 하여 사용 하면 해결 할 수 있다.

컨텐츠 파일에 아래와 같은 클래스를 등록 하고
Document class로 등록 하면,, swf가 실행 될 때 즉 movie를 기준으로 생성이 된다.
그러면 컨트롤 바에서무비가 stop()되는 것을 컨트롤 할 수 있다.

if (myMovie.isPlaying) {
myMovie.stop();
}
식으로...
체그 하면 될듯 ..




 
package {

import flash.display.MovieClip;

/**
* MovieClip class that adds an isPlaying property
* to indicate whether or not the movie clip is
* currently playing.  Have your classes extend this
* class instead of MovieClip or set this class as the
* Base class of your movie clip(s) in the library to
* have those instances gain the isPlaying property.
*/
public class MovieClipWithIsPlaying extends MovieClip {

/**
* Private property to internally keep track of whether or
* not the current movie clip is being played
*/
private var _isPlaying:Boolean = true;

/**
* Getter function creating a public, read-only isPlaying
* property allowing users to get but not set the _isPlaying
*  property to determine if the movie clip is playing
*/
public function get isPlaying():Boolean {
return _isPlaying;
}

/**
* Constructor
*/
public function MovieClipWithIsPlaying(){
super();
}

// override all timeline commands for movie clip that would
// affect the isPlaying property of the movie clip:

public override function gotoAndPlay(frame:Object, scene:String = null):void {
_isPlaying = true;
super.gotoAndPlay(frame, scene);
}

public override function gotoAndStop(frame:Object, scene:String = null):void {
_isPlaying = false;
super.gotoAndStop(frame, scene);
}

public override function nextFrame():void {
_isPlaying = false;
super.nextFrame();
}

public override function nextScene():void {
_isPlaying = true;
super.nextScene();
}

public override function play():void {
_isPlaying = true;
super.play();
}

public override function prevFrame():void {
_isPlaying = false;
super.prevFrame();
}

public override function prevScene():void {
_isPlaying = true;
super.prevScene();
}

public override function stop():void {
_isPlaying = false;
super.stop();
}
}
}

2010/03/18 22:42 2010/03/18 22:42
Posted
Filed under Action Script

[원문]  - http://theolagendijk.wordpress.com/2007/07/06/parameters-for-a-flash-9-actionscript-3-swf/

Recently I wrote a blog post about the differences between ActionScript 3.0 and ActionScript 2.0. One major difference that I found and dealt with had been lost in my unordered notes of what I wanted to write about;

Passing parameters to Flash.
Why would you want to that? Consider the case that your website consists of one giant swf file (and there are valuable reasons to have such a website). Off course the swf will probably be embedded inside a HTML page that links the swf content to some meta data and offers some alternative HTML content for the visitor that have no Flash plugin for their browser, but the content that you want to show to the visitor is all trapped inside that swf file. If for example you had blog content inside that swf, it would kind of suck that you have no means for giving friends URLs to directly jump to a specific blog post inside that swf similar to what you achieve with permalinks in HTML blogs. (I can for example give people the hyperlinks to blogging-in-flash or findability-and-linkability-with-flash to directly point them to what I want them to read about.) And this is just one example of why you would want a way of “indexing your swf”/”generate your swf based on parameters”.

So here it is then. A short explanation of implementing parameter passing to an ActionScript 3.0 swf. It still is as simple as having your browser request the swf file with extra parameters folowing the name of the file. Like this; name_of_your.swf?param1=value1&param2=value2&param3=value3 etc… this part hasn’t changed. But getting access to the passed parameters has. In ActionScript 2 you used to have global access to the parameters as they where added as variables to the _root namespace. Now it’s slightly different, they’re now stored in the loaderInfo of the Stage object. (So it’s only accessible from the Stage object itself or members of it’s display tree.
Here’s example code reading the variables;

var keyStr:String;
var valueStr:String;
var paramObj:Object = LoaderInfo(this.root.loaderInfo).parameters;
for (keyStr in paramObj) {
valueStr = String(paramObj[keyStr]);
//do something with this information
}

Something else
There’s something else that slightly touches this subject. Use the Adobe Flash Player version detection kit. The flash 9 player is taken over the old players but not everyone is having the new player yet. Be sure to detect this and gently notify your visitors of the need to update their Flash plugin. That’s so much better then seeing nothing or an incorrectly functioning website! The kit provides of examples of it’s use but it might confuse you of where to insert the Flash parameters into the JavaScript function call that generates the embedded Flash object. Just add the parameters in the src string tuple (’src’, ‘your_swf_location‘), you can omit the .swf file extension here.

For example this is the javascript (generated from a server side script) function call that embeds the Studio Roosegaarde 2.0 swf with parameter blog_item(=15);

if(hasRightVersion) { // if we’ve detected an acceptable version
// embed the flash movie
AC_FL_RunContent(
‘width’, ‘100%’,
‘height’, ‘100%’,
src‘, ‘StudioRoosegaarde2?blog_item=15‘,
‘quality’, ‘best’,
‘pluginspage’, ‘http://www.macromedia.com/go/getflashplayer’,
‘name’, ‘StudioRoosegaarde2′,
‘allowScriptAccess’,’sameDomain’,
‘allowFullScreen’,'true’
); //end AC code
}

2010/03/15 16:19 2010/03/15 16:19
Posted
Filed under Action Script

/* i needed a double click code..   
// looked around the net..   

// couldn't find anything i liked..  

// so created one for all to use..  

*/ 

 

MovieClip.prototype._onDoubleClick = function(func:Function, arg:Object) {  

    var clickInterval:Number = 20;  

   var counter:Number = 0;  

   var lastCounter:Number = 0;  
   var intervalID:Number;  
   this.onPress = function() {  
        if(counter != lastCounter) {  
            if ((counter-lastCounter)<clickInterval) {  

                func(arg);  

                clearInterval(intervalID);  

                counter = 0;  

                lastCounter = 0;  

            }  

        } else {  

            intervalID = setInterval(counterPlus, 10);  

        }  

          

        lastCounter = counter;  

    };  

      

    function counterPlus() {  

        counter++;  

        if(counter>clickInterval) {  

            clearInterval(intervalID);  

            counter = 0;  

            lastCounter = 0;  

        }  

    } 

////////////////use /////////////////////////////

function sampleFunction(str:String):Void {

trace(str);

}

mc._onDoubleClick(sampleFunction, "helloWorld");




2010/02/26 10:52 2010/02/26 10:52
Posted
Filed under Action Script

[원문]
http://osflash.org/flashcoders/undocumented/asnative

ASnative

In general, ASnative (i, j) returns a function reference. It’s like all the Flash functions are stored in a spreadsheet, and you can access them by rows and columns with ASnative. A convenient way to work with ASnative functions is to assign the result to a variable, and then execute the variable as a function.

The following list is pulled from the old flashcoders wiki, theres some annotations for various parts that could probably be added in here. You can visit the web archive to see the old page

List of ASNative functions

ASnative(1, 0) - [_global] ASSetPropFlags

ASnative(2, 0) - <not declared> former ‘ASnew’ (Flash 5)

ASnative(3, 0) - <not declared> former ‘String - internal function’ (Flash 5)

ASnative(3, 1) - <not declared> former ‘Number - internal function’ (Flash 5)

ASnative(3, 2) - <not declared> former ‘Boolean - internal function’ (Flash 5)

ASnative(3, 3) - <not declared> former ‘Object’ (Flash 5)

ASnative(3, 4) - <not declared> former ‘Number.prototype.toString’ (Flash 5)

ASnative(4, 0) - [_global] ASSetNative

ASnative(5, 0) - [Mouse] show

ASnative(5, 1) - [Mouse] hide

ASnative(9, 0) - [_global] updateAfterEvent

ASnative(10, 0) - [_global] MMSave - former ‘DashBoardSave’ (Flash 5)

ASnative(11, 0) - [System.Capabilities] Query -’Query’ is deleted after use!

ASnative(12, 0) - [System.security] allowDomain

ASnative(100, 0) - [_global] escape

ASnative(100, 1) - [_global] unescape

ASnative(100, 2) - [_global] parseInt

ASnative(100, 3) - [_global] parseFloat

ASnative(100, 4) - [_global] trace

ASnative(100, 5) - <not declared> XML escape-function

> → >

< → <

’ →

& → &

” → “

ASnative(101, 0) - [Object.prototype] watch

ASnative(101, 1) - [Object.prototype] unwatch

ASnative(101, 2) - [Object.prototype] addProperty

ASnative(101, 3) - [Object.prototype] valueOf

ASnative(101, 4) - [Object.prototype] toString

ASnative(101, 5) - [Object.prototype] hasOwnProperty

ASnative(101, 6) - [Object.prototype] isPrototypeOf

ASnative(101, 7) - [Object.prototype] isPropertyEnumerable

ASnative(101, 8) - [Object] registerClass

ASnative(101, 9) - [_global] Object | [_global] Function - player-declared, before setup-actionscript is run

ASnative(101, 10) - [Function.prototype] call

ASnative(101, 11) - [Function.prototype] apply

ASnative(101, 12) - [AsBroadcaster] broadcastMessage

ASnative(102, 0) - <not declared> former String.prototype.toUpperCase (Flash 5)

ASnative(102, 1) - <not declared> former String.prototype.toLowerCase (Flash 5)

ASnative(103, 0) - [Date.prototype] getFullYear

ASnative(103, 1) - [Date.prototype] getYear

ASnative(103, 2) - [Date.prototype] getMonth

ASnative(103, 3) - [Date.prototype] getDate

ASnative(103, 4) - [Date.prototype] getDay

ASnative(103, 5) - [Date.prototype] getHours

ASnative(103, 6) - [Date.prototype] getMinutes

ASnative(103, 7) - [Date.prototype] getSeconds

ASnative(103, 8) - [Date.prototype] getMilliseconds

ASnative(103, 9) - [Date.prototype] setFullYear

ASnative(103, 10) - [Date.prototype] setMonth

ASnative(103, 11) - [Date.prototype] setDate

ASnative(103, 12) - [Date.prototype] setHours

ASnative(103, 13) - [Date.prototype] setMinutes

ASnative(103, 14) - [Date.prototype] setSeconds

ASnative(103, 15) - [Date.prototype] setMilliseconds

ASnative(103, 16) - [Date.prototype] getTime

ASnative(103, 17) - [Date.prototype] setTime

ASnative(103, 18) - [Date.prototype] getTimezoneOffset

ASnative(103, 19) - [Date.prototype] toString

ASnative(103, 20) - [Date.prototype] setYear

ASnative(103, 128) - [Date.prototype] getUTCFullYear

ASnative(103, 129) - [Date.prototype] getUTCYear

ASnative(103, 130) - [Date.prototype] getUTCMonth

ASnative(103, 131) - [Date.prototype] getUTCDate

ASnative(103, 132) - [Date.prototype] getUTCDay

ASnative(103, 133) - [Date.prototype] getUTCHours

ASnative(103, 134) - [Date.prototype] getUTCMinutes

ASnative(103, 135) - [Date.prototype] getUTCSeconds

ASnative(103, 136) - [Date.prototype] getUTCMilliseconds

ASnative(103, 137) - [Date.prototype] setUTCFullYear

ASnative(103, 138) - [Date.prototype] setUTCMonth

ASnative(103, 139) - [Date.prototype] setUTCDate

ASnative(103, 140) - [Date.prototype] setUTCHours

ASnative(103, 141) - [Date.prototype] setUTCMinutes

ASnative(103, 142) - [Date.prototype] setUTCSeconds

ASnative(103, 143) - [Date.prototype] setUTCMilliseconds

ASnative(103, 256) - [_global] Date

ASnative(103, 257) - [Date] UTC

ASnative(104, 0) - [_global] TextField

ASnative(104, 1) - [TextField.prototype] scroll getter-function

ASnative(104, 2) - [TextField.prototype] scroll setter-function

ASnative(104, 3) - [TextField.prototype] maxScroll getter-function

ASnative(104, 4) - [TextField.prototype] maxScroll setter-function

ASnative(104, 5) - [TextField.prototype] borderColor getter-function

ASnative(104, 6) - [TextField.prototype] borderColor setter-function

ASnative(104, 7) - [TextField.prototype] backgroundColor getter-function

ASnative(104, 8) - [TextField.prototype] backgroundColor setter-function

ASnative(104, 9) - [TextField.prototype] textColor getter-function

ASnative(104, 10) - [TextField.prototype] textColor setter-function

ASnative(104, 11) - [TextField.prototype] tabIndex getter-function

ASnative(104, 12) - [TextField.prototype] tabIndex setter-function

ASnative(104, 13) - [TextField.prototype] autoSize getter-function

ASnative(104, 14) - [TextField.prototype] autoSize setter-function

ASnative(104, 15) - [TextField.prototype] text getter-function

ASnative(104, 16) - [TextField.prototype] text setter-function

ASnative(104, 17) - [TextField.prototype] type getter-function

ASnative(104, 18) - [TextField.prototype] type setter-function

ASnative(104, 19) - [TextField.prototype] htmlText getter-function

ASnative(104, 20) - [TextField.prototype] htmlText setter-function

ASnative(104, 21) - [TextField.prototype] variable getter-function

ASnative(104, 22) - [TextField.prototype] variable setter-function

ASnative(104, 23) - [TextField.prototype] hscroll getter-function

ASnative(104, 24) - [TextField.prototype] hscroll setter-function

ASnative(104, 25) - [TextField.prototype] maxhscroll getter-function

ASnative(104, 26) - [TextField.prototype] maxhscroll setter-function

ASnative(104, 27) - [TextField.prototype] maxChars getter-function

ASnative(104, 28) - [TextField.prototype] maxChars setter-function

ASnative(104, 29) - [TextField.prototype] embedFonts getter-function

ASnative(104, 30) - [TextField.prototype] embedFonts setter-function

ASnative(104, 31) - [TextField.prototype] html getter-function

ASnative(104, 32) - [TextField.prototype] html setter-function

ASnative(104, 33) - [TextField.prototype] border getter-function

ASnative(104, 34) - [TextField.prototype] border setter-function

ASnative(104, 35) - [TextField.prototype] background getter-function

ASnative(104, 36) - [TextField.prototype] background setter-function

ASnative(104, 37) - [TextField.prototype] wordWrap getter-function

ASnative(104, 38) - [TextField.prototype] wordWrap setter-function

ASnative(104, 39) - [TextField.prototype] password getter-function

ASnative(104, 40) - [TextField.prototype] password setter-function

ASnative(104, 41) - [TextField.prototype] multiline getter-function

ASnative(104, 42) - [TextField.prototype] multiline setter-function

ASnative(104, 43) - [TextField.prototype] selectable getter-function

ASnative(104, 44) - [TextField.prototype] selectable setter-function

ASnative(104, 45) - [TextField.prototype] length getter-function

ASnative(104, 46) - [TextField.prototype] length setter-function

ASnative(104, 47) - [TextField.prototype] bottomScroll getter-function

ASnative(104, 48) - [TextField.prototype] bottomScroll setter-function

ASnative(104, 49) - [TextField.prototype] textWidth getter-function

ASnative(104, 50) - [TextField.prototype] textWidth setter-function

ASnative(104, 51) - [TextField.prototype] textHeight getter-function

ASnative(104, 52) - [TextField.prototype] textHeight setter-function

ASnative(104, 53) - [TextField.prototype] restrict getter-function

ASnative(104, 54) - [TextField.prototype] restrict setter-function

ASnative(104, 55) - [TextField.prototype] condenseWhite getter-function

ASnative(104, 56) - [TextField.prototype] condenseWhite setter-function

ASnative(104, 100) - [TextField.prototype] replaceSel

ASnative(104, 101) - [TextField.prototype] getTextFormat

ASnative(104, 102) - [TextField.prototype] setTextFormat

ASnative(104, 103) - [TextField.prototype] removeTextFormat

ASnative(104, 104) - [TextField.prototype] getNewTextFormat

ASnative(104, 105) - [TextField.prototype] setNewTextFormat

ASnative(104, 106) - [TextField.prototype] getDepth

ASnative(104, 200) - [MovieClip.prototype] createTextField

ASnative(104, 201) - [TextField] getFontList

ASnative(105, 0) - [_global] Button

ASnative(105, 1) - [Button.prototype] tabIndex getter-function

ASnative(105, 2) - [Button.prototype] tabIndex setter-function

ASnative(105, 3) - [Button.prototype] getDepth

ASnative(106, 0) - [Number.prototype] valueOf

ASnative(106, 1) - [Number.prototype] toString

ASnative(106, 2) - [_global] Number

ASnative(107, 0) - [Boolean.prototype] valueOf

ASnative(107, 1) - [Boolean.prototype] toString

ASnative(107, 2) - [_global] Boolean

ASnative(110, 0) - [_global] TextFormat

ASnative(110, 1) - [TextFormat.prototype] font getter-function

ASnative(110, 2) - [TextFormat.prototype] font setter-function

ASnative(110, 3) - [TextFormat.prototype] size getter-function

ASnative(110, 4) - [TextFormat.prototype] size setter-function

ASnative(110, 5) - [TextFormat.prototype] color getter-function

ASnative(110, 6) - [TextFormat.prototype] color setter-function

ASnative(110, 7) - [TextFormat.prototype] url getter-function

ASnative(110, 8) - [TextFormat.prototype] url setter-function

ASnative(110, 9) - [TextFormat.prototype] target getter-function

ASnative(110, 10) - [TextFormat.prototype] target setter-function

ASnative(110, 11) - [TextFormat.prototype] bold getter-function

ASnative(110, 12) - [TextFormat.prototype] bold setter-function

ASnative(110, 13) - [TextFormat.prototype] italic getter-function

ASnative(110, 14) - [TextFormat.prototype] italic setter-function

ASnative(110, 15) - [TextFormat.prototype] underline getter-function

ASnative(110, 16) - [TextFormat.prototype] underline setter-function

ASnative(110, 17) - [TextFormat.prototype] align getter-function

ASnative(110, 18) - [TextFormat.prototype] align setter-function

ASnative(110, 19) - [TextFormat.prototype] leftMargin getter-function

ASnative(110, 20) - [TextFormat.prototype] leftMargin setter-function

ASnative(110, 21) - [TextFormat.prototype] rightMargin getter-function

ASnative(110, 22) - [TextFormat.prototype] rightMargin setter-function

ASnative(110, 23) - [TextFormat.prototype] indent getter-function

ASnative(110, 24) - [TextFormat.prototype] indent setter-function

ASnative(110, 25) - [TextFormat.prototype] leading getter-function

ASnative(110, 26) - [TextFormat.prototype] leading setter-function

ASnative(110, 27) - [TextFormat.prototype] blockIndent getter-function

ASnative(110, 28) - [TextFormat.prototype] blockIndent setter-function

ASnative(110, 29) - [TextFormat.prototype] tabStops getter-function

ASnative(110, 30) - [TextFormat.prototype] tabStops setter-function

ASnative(110, 31) - [TextFormat.prototype] bullet getter-function

ASnative(110, 32) - [TextFormat.prototype] bullet setter-function

ASnative(110, 33) - <TextFormat-instance> getTextExtent

ASnative(200, 0) - [Math] abs

ASnative(200, 1) - [Math] min

ASnative(200, 2) - [Math] max

ASnative(200, 3) - [Math] sin

ASnative(200, 4) - [Math] cos

ASnative(200, 5) - [Math] atan2

ASnative(200, 6) - [Math] tan

ASnative(200, 7) - [Math] exp

ASnative(200, 8) - [Math] log

ASnative(200, 9) - [Math] sqrt

ASnative(200, 10) - [Math] round

ASnative(200, 11) - [Math] random

ASnative(200, 12) - [Math] floor

ASnative(200, 13) - [Math] ceil

ASnative(200, 14) - [Math] atan

ASnative(200, 15) - [Math] asin

ASnative(200, 16) - [Math] acos

ASnative(200, 17) - [Math] pow

ASnative(200, 18) - [_global] isNaN

ASnative(200, 19) - [_global] isFinite

ASnative(250, 0) - [_global] setInterval

ASnative(250, 1) - [_global] clearInterval

ASnative(251, 0) - [_global] String

ASnative(251, 1) - [String.prototype] valueOf

ASnative(251, 2) - [String.prototype] toString

ASnative(251, 3) - [String.prototype] toUpperCase

ASnative(251, 4) - [String.prototype] toLowerCase

ASnative(251, 5) - [String.prototype] charAt

ASnative(251, 6) - [String.prototype] charCodeAt

ASnative(251, 7) - [String.prototype] concat

ASnative(251, 8) - [String.prototype] indexOf

ASnative(251, 9) - [String.prototype] lastIndexOf

ASnative(251, 10) - [String.prototype] slice

ASnative(251, 11) - [String.prototype] substring

ASnative(251, 12) - [String.prototype] split

ASnative(251, 13) - [String.prototype] substr

ASnative(251, 14) - [String] fromCharCode

ASnative(252, 0) - [_global] Array

ASnative(252, 1) - [Array.prototype] push

ASnative(252, 2) - [Array.prototype] pop

ASnative(252, 3) - [Array.prototype] concat

ASnative(252, 4) - [Array.prototype] shift

ASnative(252, 5) - [Array.prototype] unshift

ASnative(252, 6) - [Array.prototype] slice

ASnative(252, 7) - [Array.prototype] join

ASnative(252, 8) - [Array.prototype] splice

ASnative(252, 9) - [Array.prototype] toString

ASnative(252, 10) - [Array.prototype] sort

ASnative(252, 11) - [Array.prototype] reverse

ASnative(252, 12) - [Array.prototype] sortOn

ASnative(253, 0) - [_global] XMLNode

ASnative(253, 1) - [XMLNode.prototype] cloneNode

ASnative(253, 2) - [XMLNode.prototype] removeNode

ASnative(253, 3) - [XMLNode.prototype] insertBefore

ASnative(253, 4) - [XMLNode.prototype] appendChild

ASnative(253, 5) - [XMLNode.prototype] hasChildNodes

ASnative(253, 6) - [XMLNode.prototype] toString

ASnative(253, 7) - [_global] XML

ASnative(253, 8) - [XML.prototype] createElement

ASnative(253, 9) - [XML.prototype] createTextNode

ASnative(253, 10) - [XML.prototype] parseXML

ASnative(300, 0) - <not declared> former XML.prototype.parseXML - inner function (Flash 5)

ASnative(301, 0) - [XML.prototype] load

ASnative(301, 1) - [XML.prototype] send

ASnative(301, 2) - [XML.prototype] sendAndLoad

ASnative(301, 3) - [LoadVars.prototype] decode

ASnative(302, 0) - [Cookie] getCookie - inner function

ASnative(302, 1) - [Cookie] setCookie

ASnative(303, 0) - [CustomActions] install

ASnative(303, 1) - [CustomActions] uninstall

ASnative(303, 2) - [CustomActions] list

ASnative(303, 3) - [CustomActions] get

ASnative(400, 0) - [XMLSocket.prototype] connect

ASnative(400, 1) - [XMLSocket.prototype] send

ASnative(400, 2) - [XMLSocket.prototype] close

ASnative(500, 0) - [Sound.prototype] getPan

ASnative(500, 1) - [Sound.prototype] getTransform

ASnative(500, 2) - [Sound.prototype] getVolume

ASnative(500, 3) - [Sound.prototype] setPan

ASnative(500, 4) - [Sound.prototype] setTransform

ASnative(500, 5) - [Sound.prototype] setVolume

ASnative(500, 6) - [Sound.prototype] stop

ASnative(500, 7) - [Sound.prototype] attachSound

ASnative(500, 8) - [Sound.prototype] start

ASnative(500, 9) - [Sound.prototype] getDuration

ASnative(500, 10) - [Sound.prototype] setDuration

ASnative(500, 11) - [Sound.prototype] getPosition

ASnative(500, 12) - [Sound.prototype] setPosition

ASnative(500, 13) - [Sound.prototype] loadSound

ASnative(500, 14) - [Sound.prototype] getBytesLoaded

ASnative(500, 15) - [Sound.prototype] getBytesTotal

ASnative(500, 16) - [_global] Sound

ASnative(500, 32) - [Sound.prototype] id3 getter-function

ASnative(600, 0) - [Selection] getBeginIndex

ASnative(600, 1) - [Selection] getEndIndex

ASnative(600, 2) - [Selection] getCaretIndex

ASnative(600, 3) - [Selection] getFocus

ASnative(600, 4) - [Selection] setFocus

ASnative(600, 5) - [Selection] setSelection

ASnative(666, 1) - [Stage] scaleMode getter-function

ASnative(666, 2) - [Stage] scaleMode setter-function

ASnative(666, 3) - [Stage] align getter-function

ASnative(666, 4) - [Stage] align setter-function

ASnative(666, 5) - [Stage] width getter-function

ASnative(666, 6) - [Stage] width setter-function

ASnative(666, 7) - [Stage] height getter-function

ASnative(666, 8) - [Stage] height setter-function

ASnative(666, 9) - [Stage] showMenu getter-function

ASnative(666, 10) - [Stage] showMenu setter-function

ASnative(667, 0) - [_global] Video

ASnative(667, 1) - [Video.prototype] attachVideo

ASnative(667, 2) - [Video.prototype] clear

ASnative(700, 0) - [Color.prototype] setRGB

ASnative(700, 1) - [Color.prototype] setTransform

ASnative(700, 2) - [Color.prototype] getRGB

ASnative(700, 3) - [Color.prototype] getTransform

ASnative(800, 0) - [Key] getAscii

ASnative(800, 1) - [Key] getCode

ASnative(800, 2) - [Key] isDown

ASnative(800, 3) - [Key] isToggled

ASnative(900, 0) - [MovieClip.prototype] attachMovie

ASnative(900, 1) - [MovieClip.prototype] swapDepths

ASnative(900, 2) - [MovieClip.prototype] localToGlobal

ASnative(900, 3) - [MovieClip.prototype] globalToLocal

ASnative(900, 4) - [MovieClip.prototype] hitTest

ASnative(900, 5) - [MovieClip.prototype] getBounds

ASnative(900, 6) - [MovieClip.prototype] getBytesTotal

ASnative(900, 7) - [MovieClip.prototype] getBytesLoaded

ASnative(900, 8) - [MovieClip.prototype] attachAudio

ASnative(900, 9) - [MovieClip.prototype] attachVideo

ASnative(900, 10) - [MovieClip.prototype] getDepth

ASnative(900, 11) - [MovieClip.prototype] setMask

ASnative(900, 12) - [MovieClip.prototype] play

ASnative(900, 13) - [MovieClip.prototype] stop

ASnative(900, 14) - [MovieClip.prototype] nextFrame

ASnative(900, 15) - [MovieClip.prototype] prevFrame

ASnative(900, 16) - [MovieClip.prototype] gotoAndPlay

ASnative(900, 17) - [MovieClip.prototype] gotoAndStop

ASnative(900, 18) - [MovieClip.prototype] duplicateMovieClip

ASnative(900, 19) - [MovieClip.prototype] removeMovieClip

ASnative(900, 20) - [MovieClip.prototype] startDrag

ASnative(900, 21) - [MovieClip.prototype] stopDrag

ASnative(900, 200) - [MovieClip.prototype] tabIndex getter-function

ASnative(900, 201) - [MovieClip.prototype] tabIndex setter-function

ASnative(901, 0) - [MovieClip.prototype] createEmptyMovieClip

ASnative(901, 1) - [MovieClip.prototype] beginFill

ASnative(901, 2) - [MovieClip.prototype] beginGradientFill

ASnative(901, 3) - [MovieClip.prototype] moveTo

ASnative(901, 4) - [MovieClip.prototype] lineTo

ASnative(901, 5) - [MovieClip.prototype] curveTo

ASnative(901, 6) - [MovieClip.prototype] lineStyle

ASnative(901, 7) - [MovieClip.prototype] endFill

ASnative(901, 8) - [MovieClip.prototype] clear

ASnative(1999, 0) - [Accessibility] IsActive

ASnative(1999, 1) - [Accessibility] SendEvent

ASnative(1999, 2) - [Accessibility] updateProperties -new function in beta-player 6,0,60,48

ASnative(2100, 0) - [NetConnection.prototype] connect

ASnative(2100, 1) - [NetConnection.prototype] close

ASnative(2100, 2) - [NetConnection.prototype] call

ASnative(2100, 3) - [NetConnection.prototype] addheader

ASnative(2100, 200) - [NetConnection] NetConnection inner function - primative object killer

ASnative(2101, 0) - [NetStream.prototype] close

ASnative(2101, 1) - [NetStream.prototype] attachAudio

ASnative(2101, 2) - [NetStream.prototype] attachVideo

ASnative(2101, 3) - [NetStream.prototype] send

ASnative(2101, 4) - [NetStream.prototype] setBufferTime

ASnative(2101, 200) - [NetStream] NetStream inner function

ASnative(2101, 201) - [NetStream] NetStream > [OnCreate.prototype] onResult - inner function

ASnative(2101, 202) - [NetStream.prototype] publish|play|receiveAudio|receiveVideo|pause|seek - inner function

ASnative(2102, 0) - [Camera.prototype] setMode

ASnative(2102, 1) - [Camera.prototype] setQuality

ASnative(2102, 2) - [Camera.prototype] setKeyFrameInterval

ASnative(2102, 3) - [Camera.prototype] setMotionLevel

ASnative(2102, 4) - [Camera.prototype] setLoopback

ASnative(2102, 200) - [Camera] get

ASnative(2102, 201) - [Camera] names getter-function

ASnative(2104, 0) - [Microphone.prototype] setSilenceLevel

ASnative(2104, 1) - [Microphone.prototype] setRate

ASnative(2104, 2) - [Microphone.prototype] setGain

ASnative(2104, 3) - [Microphone.prototype] setUseEchoSuppression

ASnative(2104, 200) - [Microphone] get

ASnative(2104, 201) - [Microphone] names getter-function

ASnative(2106, 0) - [SharedObject.prototype] connect

ASnative(2106, 1) - [SharedObject.prototype] send

ASnative(2106, 2) - [SharedObject.prototype] flush

ASnative(2106, 3) - [SharedObject.prototype] close

ASnative(2106, 4) - [SharedObject.prototype] getSize

ASnative(2106, 5) - [SharedObject.prototype] setFps

ASnative(2106, 202) - [SharedObject] getLocal - inner function

ASnative(2106, 203) - [SharedObject] getRemote - inner function

ASnative(2106, 204) - [SharedObject] getLocal - inner function

ASnative(2106, 205) - [SharedObject] getRemote - inner function

ASnative(2106, 206) - [SharedObject] deleteAll - inner function

ASnative(2106, 207) - [SharedObject] getDiskUsage - inner function

ASnative(2107, 0) - [System] ShowSettings

ASnative(2200, 0) - [LocalConnection.prototype] connect

ASnative(2200, 1) - [LocalConnection.prototype] send

ASnative(2200, 2) - [LocalConnection.prototype] close

ASnative(2200, 3) - [LocalConnection.prototype] domain

ASnative(2201, 0) - [System.Product.prototype] IsRunning - inner function

ASnative(2201, 1) - [System.Product.prototype] IsInstalled - inner function

ASnative(2201, 2) - [System.Product.prototype] Launch - inner function

ASnative(2201, 3) - [System.Product.prototype] Download - inner function

2010/02/26 10:48 2010/02/26 10:48
Posted
Filed under Action Script
package
{
   import flash.display.MovieClip;
   import flash.display.SWFLoaderInfo;
   
   public dynamic class Main extends MovieClip
   {
      public var info:SWFLoaderInfo = SWFLoaderInfo(this.loaderInfo);
      public var listxml:String;
      public var path:String;

      public function Main()
      {
         // URL-Encoded query string to variablize
         if(!info.arguments.path)
         {
            this.listxml = info.arguments.listxml;
         }
         else if(!info.arguments.listxml)
         {
            this.path = info.arguments.path;
         }

      }
}
2010/02/05 09:20 2010/02/05 09:20
Posted
Filed under Action Script


flash 에서 오른쪽 마우스를 사용 하기 위해서
ASnative 를 이용해서 dispatch 한 이벤트를 실행 한다.
버튼, 무비클립 클릭 용으로 만들었다.

swf 파일을 html에서 embead 할 때 menu=false로 지정 한다. 그래야 flash 상에서 메뉴 버튼이 나타나지 않는다.

flash의 1번째 프레임에 다음과 같이 선언 한다.
소스는 actionscript 를 조금만 할 줄 알면 누구나 이해 할 수 있음으로,, 설명은 생략 ...
소스 사용으로 perfomence 저하에 대해서는 책임 못짐...


var EventStack:Array  =new  Array();

this.onEnterFrame = function() {
 //dispitchEvent by MouseRightBtnClick
 
 if (ASnative(800, 2)(2)) {
  //객체 찾기
  var temp:Array=find_object(this._currentframe);
  for(i:Number=0; i<temp.length; i++){
   if(is_mouseOver(this[temp[i].eventTarget])==true){
    //method call;
    var method:String = temp[i].tirggerMethod;
    this[method]();
    removeEventStack(temp[i].frameNo,temp[i].eventTarget,temp[i].tirggerMethod);
   }//end if
  }//end for
 }//end if
}//end EnterFrame


//등록
function regist(frameNo:String,eventTarget:String,tirggerMethod:String):Void{
 var defaultObj:Object = new Object();
 defaultObj.frameNo=frameNo;
 defaultObj.eventTarget=eventTarget;
 defaultObj.tirggerMethod =tirggerMethod;
 EventStack.push(defaultObj);
}


// is mouseOver
function is_mouseOver(o:Object){
 var is:Boolean=false;
 if(o.hitTest(_root._xmouse,_root._ymouse, false)){
  is=true;
 }
 return is;
}

function find_object(frameNo:String):Array{
 var objArray:Array = new Array();
 for(i:Number=0; i<EventStack.length; i++){
  if(EventStack[i].frameNo==frameNo){
   objArray.push(EventStack[i]);
  }
 }
 return objArray;
}

function removeEventStack(frameNo:String,eventTarget:String,tirggerMethod:String){
 for(i:Number =0; i<EventStack.length; i++){
  if(EventStack[i].frameNo==frameNo){
   if(EventStack[i].eventTarget==eventTarget){
    if(EventStack[i].tirggerMethod==tirggerMethod){
     array_slice(EventStack,i);
     break;
    }
   }
  }
 }
}

function array_slice(target_array:Array, target_num:Number){
 for(var i=0; i<target_array.length; i++){
   if(i==target_num){
    target_array.splice(i,1);
   }
 }
}


마우스 오른쪽 버튼을 클릭 할 위치에
 
stop();
//_currentframe 현제 프레임 번호 , bg1 <-- 이벤트가 발생할 객체(버튼, 무비클립), fun1 <-- 이벤트가 발생 할 후 호출될 함수 명     함수 명은 수정 될 수 있으나 해당 함수를  반드시 구현 해줘야 한다.

regist(_currentframe,"bg1","fun1");

//callback function
function fun1(){
   //마우스 오른쪽 버튼 클릭시 실행될 내용
 trace("mouseclick");

}

2010/02/02 15:31 2010/02/02 15:31
Posted
Filed under Action Script

stop();

var str:String = "fun1";
this[str]();
function fun1():Void{
 trace("fun1");
}
java 에 reflection과 비슷한 함수 호출 방법을 찾던중 위와 같이 가능 하다는 사실을 아게 됬다.
this <-- 대신 생성된 클래스를 넣게 되면 해당 클래스의 해당 메소드를 찾게 된다.
AA aa = new AA();
var str:String = "fun1";
aa[str]();
function fun1():Void{
 trace("fun1");
}

물론 AA라는 클레스가 존재 해야 한다. as2.0 기준으로 테스트  했음.

2010/02/02 14:22 2010/02/02 14:22
Posted
Filed under Action Script

 flash 컨텐츠를 작업 하다 보면 배포 하는 용도에 따라서 class file 즉 as 파일의 위치를  설정 해줘야 할 경우가 발생 한다. 그리고 상황에 따라서 어떤 일에 대한 다른 view를 만들기 위해서 설정 값에 의해서 실행하는 일들이 달라 진다고 했을 때 , 해당 클래스명을 받아 동적으로 생성하여 처리를 할 수 있다. 마치 java의 reflection과 비슷한 기능 이라 할 수 있을 거 같다.

 아래는 api에서 복사 했으며, 이것들을 이용하여 구현이 가능 하다.
hasDefinition을 통해서 해당 클래스가 존재 하는지 체크 후 , hasDefinition 메소드로 해당 클레스를
가져와 객체로 생성 하면 된다.

Creates a new application domain.
Checks to see if a public definition exists within the specified application domain.
Gets a public definition from the specified application domain.

google에서 검색해서 찾은 소스 이면 더 자세한 내용은 링크를 참조 하면되다.
[소스참조]  : http://snipplr.com/view.php?codeview&id=18147
var instance:Sprite;

if ( ApplicationDomain.currentDomain.hasDefinition("MyClassName") )
{
 var MyClass:Class = getDefinitionByName( "MyClassName" ) as Class;
 instance = new MyClass( params ) as Sprite;
}else {
 instance = new Sprite( params );
}

2010/01/30 17:12 2010/01/30 17:12