Q: how to create custom events

Ask a Question related to Macromedia Flash Actionscript, Design and Development.

  1. #1

    Default Q: how to create custom events

    ok ive been all through the manual again trying to figure this out but i
    just cant find it.
    how can i generate my own custom event ?
    for example : movie clip A moves to the left and when it gets to the left
    border of the screen i want it to trigger an event call
    I-Got-To-The-Left-Most-Side-Of-The-Screen [or - IGTTLMSOTS ;)].
    thx for any help on this


    baEc Guest

  2. Similar Questions and Discussions

    1. Custom Events in Web Services
      Hello, I have created a class with custom events. The delegate for the event is created before the class is declared. This event works fine when...
    2. Bubbling up custom events in datagrid
      I have a custom web control GridList which contains an array of derived Datagrid controls. Each datagrid has an additional event OnRowSelect, fired...
    3. how to add events to a custom control
      "TIBM" <TIBM@discussions.microsoft.com> wrote in message news:15A29094-90DA-4E14-80B5-A433BE45136F@microsoft.com......
    4. Events in Custom Controls and Sub Classes
      Hello i try do this. Class DemoBase Public Delegate Sub DemoItemEventHandler(ByVal sender As Object, ByVal e _ As DemoItemEventArgs) Public...
    5. Custom Server Control Events
      This a newbie question but I would like to build a custom server control which updates a database. While I have got as far as writing in HTML via...
  3. #2

    Default Re: Q: how to create custom events

    Flash MX 2004 documentation:

    Did you see these pages?:
    Creating events:
    [url]http://livedocs.macromedia.com/flash/mx2004/main/05_cre34.htm[/url]

    Dispatching events:
    [url]http://livedocs.macromedia.com/flash/mx2004/main/05_cre44.htm[/url]

    Handling events:
    [url]http://livedocs.macromedia.com/flash/mx2004/main/05_cre41.htm[/url]

    Assuming you already have you custom class, make you class match this:

    import mx.events.UIEvent;
    import mx.core.UIObject;

    [Event("IGTTLMSOTS")]
    class myClass extends UIObject {
    .... // other declarations
    function reachLeft(){
    dispatchEvent ({type:"IGTTLMSOTS", arg1, arg2 });
    }
    .... // other declarations
    }

    good luck


    baEc wrote:
    > ok ive been all through the manual again trying to figure this out but i
    > just cant find it.
    > how can i generate my own custom event ?
    > for example : movie clip A moves to the left and when it gets to the left
    > border of the screen i want it to trigger an event call
    > I-Got-To-The-Left-Most-Side-Of-The-Screen [or - IGTTLMSOTS ;)].
    > thx for any help on this
    >
    >
    Uritsukidoji Guest

  4. #3

    Default Re: Q: how to create custom events

    hey Uritsukidoji, thx for your help. i dont know much about component
    creation. i was trying to avoid that subject but maybe i will have to go
    into it after all. is extending UIObject the only way i can define my own
    events ? i think in flash mx [not 2004] you could do something like this -

    Counter = function(max){
    this.max = max;
    this.value = 0;
    }
    Counter.prototype.increment = function(){
    ++this.value;
    if (this.counter == this.max){
    this.onMax(); // here's the new event call
    this.counter = 0;
    }
    }

    i got this example somewhere but im not really sure where anymore and
    whether it still would work with the new flash ??


    baEc Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

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 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139