A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Get parent or class of event

  1. #1
    Registered User
    Join Date
    Mar 2012
    Posts
    1

    Get parent or class of event

    Hello!

    I have a class called "download" and an URLStream object inside it called "urlStream".

    From outside the class, I am adding a progress listener like this:
    download.urlStream.addEventListener(ProgressEvent. PROGRESS,onFileProgress);

    Everything works fine inside the onFileProgress function and bytesLoaded, bytesTotal are read correctly.

    What I need is a way to point to the download class from inside the onFileProgress function so that I can retrieve some other public variables defined in the "download" class.

    I tried things like:
    function onFileProgress(e:ProgressEvent):void {
    trace(ProgressEvent(e).parent)
    }

    But obviously didn't work.

    I am pretty new with AS3, having started learning it about a month ago, so excuse me if this question is stupid.

    Thanks!

  2. #2
    Senior Member cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,449
    You need to specify the target for the event first:
    e.currentTarget.parent
    - The right of the People to create Flash movies shall not be infringed. -

Posting Permissions

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




Click Here to Expand Forum to Full Width

HTML5 Development Center