AS3 Window System (Updated!)

Updated at last and looks much the same. See it here.

The HUD window now accepts a Rectangle, the manager returns the window itself so you can do stuff with it, plus it’s now dead easy to add content. A HUDContent MovieClip just needs a rectangular MC inside it called winArea to define the initial visible area. This can be placed anywhere in the HUDContent and seems to work a treat. Here’s what you do:

1
2
3
4
5
6
7
import tv.palmerama.gui.*;

var rect:Rectangle = new Rectangle(10, 10, 350, 200);
var HUDwindow:HUD = winManager.newWindow(rect, 0.2, "My First HUD Window", true, true);

var winContents:WinContents = new WinContents();
HUDwindow.setContents(winContents);

Just extend HUDContent for content movieclips. Incidentally, this class may not seem to do much at the moment, just allowing control over resizing, but I have a feeling I may add more functionality sometime soon so it makes sense to use it now.

Here’s a zip of the source with the FLA as an example and the Classes. And yes, please use it for anything you like. It’d just be nice to see it though, if you do. Cheers.

Next step’s probably to add functionality to make the windows work as proper AIR windows on the desktop. Could be handy I think.

10 Responses to “AS3 Window System (Updated!)”

-->

Comments:


  1. Very nice work!
    However if you put content that includes actionscripting in the WinContents movieclip it crashes – it accepts only static content like images etc. – is there any chance that you will publish a more updated version including minimize and maximize functions ?
    Again great work! keep it up!

  2. That’s very odd. It’s just a MovieClip, extending tv.palmerama.gui.HUDContent, so just about anything you add in there should work. It’s definitely not restricted to static content of any kind. In fact, in this post there’s a load of AS in the window. It’s expecting to find an MC called winArea inside it, so if that’s missing you’ll get an error. Could be that maybe..?

    No plans for maximise or minimise at the moment, as it’s just supposed to mimic Apple’s HUD.

  3. This is great. I am new at flash/actionscript and am trying to figure out how to change the content of the window. I can’t, for the life of me, find WinContents() to see what exactly that does. I understand that I am supposed to call HUDwindow.setContents() with the MC i want to put in it, but i wanted to see WinContents to see how it sets everything up.

    Again, this is *really* cool and I appreciate you sharing it.

  4. What I really want to do is create 3 buttons. Button A would open a new window and populate it with a static webpage. Buttons B and C would do the same thing, but point to different web pages. is this even possible?

  5. WinContents isn’t actually a class, it’s just a MovieClip with the base class HUDContent. This is just the way I set it up in this example to make it easier to use! Obviously called some confusion instead. Sorry…

    If you want to do it purely in code, just extend tv.palmerama.gui.HUDContent and make sure the MC contains another MC called winArea, which is used to define the visible part.

    As far as putting webpages in these windows goes, you’re only going to be able to do that in AIR I’m afraid, not in the flash player.

    Hope that helps!

  6. Hey how to make Text into Window???

  7. Good question, Kevin. You mean like some kind of alchemy?

  8. Cheers for the source, very clean.
    I am learning much from this :)

  9. Really I can’t find anything like this on the web. thanks!!!!!!

  10. Thanks :-)

Say your piece...