[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Trouble with Event Dispatching between Parent and Child Classes

Posted on 2008-06-18
3
Medium Priority
?
438 Views
Last Modified: 2013-11-11
I am developing an application to load pictures from an XML backend to display to the user. I would like to use JavaScript to resize the viewable div the flash app occupies. I have the code to do this. However, since the dimensions of the content are not set until everything is loaded, the resizing must be done after all of the loading is finished. Currently, I have a ContentClip class, which will be loaded into a parent SWF for viewing. This ContentClip class contains an instance of a Picture class, which is responsible for downloading, sizing and adding the picture. I am trying to fire an event upon the completion of the picture loading process, which will notify the ContentClip. After some accounting, this ContentClip will determine when everything has loaded, and notify the parent SWF to resize the div. Currently, the event fires in the Picture class, and is recognized in the class. However, the event listener in the ContentClip is not triggered. This is strange, since very similar code works elsewhere in the application without hitches. Attached are the relevant class files. Thank you for any assistance you may be able to provide!
ContentClip.as.txt
Picture.as.txt
0
Comment
Question by:ckoning
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 4

Accepted Solution

by:
emphaticDigital earned 2000 total points
ID: 21822960
Hello,

In order for a class to receive notification of another classes events, two things must happen. One, the event itself must 'bubble' or share the event dispatch with its ancestors and Two, the class that wants to receive notification must be an 'ancestor' of the dispatching class.

Most of the time this happens with display objects that have a parent child relationship. Bubbling is automatic for objects in the same display heirarchy.

For this to work, I think you have to create a custom event class, including overridding the 'clone' and 'toString' methods of the base class. I'm at work now, but will try to work it out tonight. Check back.

Hope this helps a little.
0
 
LVL 4

Author Closing Comment

by:ckoning
ID: 31468238
Thank you! I have since studied up on AS3's inheritance and event models. This tip put me on a good track.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In Part 1 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7849-Hex-Maze.html) we covered the hexagonal maze basics -- how the cells are represented in a JavaScript array and how the maze is displayed.  In this part, we'…
I have found that much of my time doing support ends up being a constant repetition of the same steps to different people.  Early on I stated using web pages with Frequently Asked Questions (FAQs) to alleviate most of the burden.  Sometimes this jus…
In this tutorial viewers will learn how to create a basic shape tween animation in Flash including shape hints for smooth animation Open a new document in Flash: Draw a shape: Select another frame (how long you want the tween to be): Right click and…
The goal of the tutorial is to teach the user how to use the auto adjust feature and what the different options do. When your video is not working right you can choose the auto adjust feature to help choose your settings.

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question