Note that there are some explanatory texts on larger screens.

plurals
  1. POAction Script 3 Static Method
    primarykey
    data
    text
    <p>I'm new to Action-script OOP and i need to know how to chain methods like this example i have </p> <p><code>I.$(button).bind('click',clickButton).bind('rollover',overButton).bind('rollout',outButton)</code></p> <p>First i need to remove the <code>I.</code> to use dollar sign only like jQuery :) to select MovieClip and apply any action on it second issue that i have because this way i'm using static Methods Action-script restrict's me to use only static property saving the last one who called the action here is the class code to know what i mean:</p> <pre><code>package com.MAIN { import flash.display.Sprite; import flash.events.MouseEvent; public class I extends Sprite { private static var cSelector:Sprite; public static function $(selector:Sprite) { cSelector = selector return I; } public static function alpha(val:Number) { cSelector.alpha = val; return I; } // bind mouse event to the element public static function bind(EventStr,func:Function) { var func1:Function = function(e:MouseEvent){ func(cSelector); } // select the event from the list if(typeof(EventStr) == 'string'){ // map the events in lowercase var events:Object = {click:'CLICK',rollover:'ROLL_OVER',rollout:'ROLL_OUT',dblclick:'DOUBLE_CLICK',mousedown:'MOUSE_DOWN',mousemove:'MOUSE_MOVE',mouseout:'MOUSE_OUT',mouseover:'MOUSE_OVER',mouseup:'MOUSE_UP',mousewheel:'MOUSE_WHEEL'}; // check if the event exists in the list if(events[EventStr] &amp;&amp; MouseEvent[events[EventStr]]){ cSelector.addEventListener(MouseEvent[events[EventStr]],func1); } }else if(typeof(EventStr) == 'object'){ // add the event cSelector.addEventListener(EventStr,func1); } return I; } public static function remove() { cSelector.parent.removeChild(cSelector); return I; } } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload