| /trunk/as3/examples/components/Demo_01_Panel.as r58 | /trunk/as3/examples/components/Demo_01_Panel.as r67 | ||
| 1 | /** | 1 | /** |
|---|---|---|---|
| 2 | * This code is part of the Bumpslide Library by David Knape | 2 | * This code is part of the Bumpslide Library by David Knape |
| 3 | * http://bumpslide.com/ | 3 | * http://bumpslide.com/ |
| 4 | * | 4 | * |
| 5 | * Copyright (c) 2006, 2007, 2008 by Bumpslide, Inc. | 5 | * Copyright (c) 2006, 2007, 2008 by Bumpslide, Inc. |
| 6 | * | 6 | * |
| 7 | * Released under the open-source MIT license. | 7 | * Released under the open-source MIT license. |
| 8 | * http://www.opensource.org/licenses/mit-license.php | 8 | * http://www.opensource.org/licenses/mit-license.php |
| 9 | * see LICENSE.txt for full license terms | 9 | * see LICENSE.txt for full license terms |
| 10 | */ | 10 | */ |
| 11 | package { | 11 | package { |
| 12 | import flash.utils.getTimer; | ||
| 12 | import flash.display.Loader; | 13 | import flash.display.Loader; |
| 13 | import flash.net.URLRequest; | 14 | import flash.net.URLRequest; |
| 14 | 15 | ||
| 15 | import com.bumpslide.ui.Applet; | 16 | import com.bumpslide.ui.Applet; |
| 16 | import com.bumpslide.ui.Panel; | 17 | import com.bumpslide.ui.Panel; |
| 17 | 18 | ||
| 18 | /** | 19 | /** |
| 19 | * Barebones Panel Test - content is unare of the panel | 20 | * Barebones Panel Test - content is unare of the panel |
| 20 | * | 21 | * |
| 21 | * @mxmlc -sp+=../../classes | 22 | * @mxmlc -sp+=../../classes -debug=true |
| 22 | * @author David Knape | 23 | * @author David Knape |
| 23 | */ | 24 | */ |
| 24 | public class Demo_01_Panel extends Applet { | 25 | public class Demo_01_Panel extends Applet { |
| 25 | 26 | ||
| 26 | private var panel:Panel; | 27 | private var panel:Panel; |
| 27 | private var image:Loader; | 28 | private var image:Loader; |
| 28 | 29 | ||
| 29 | override protected function addChildren():void { | 30 | override protected function addChildren():void { |
| 30 | 31 | ||
| 31 | // create panel with x=10, y=10 | 32 | // create panel with x=10, y=10 |
| 32 | panel = new Panel(); | 33 | panel = new Panel(); |
| 33 | panel.move(10, 10); | 34 | panel.move(10, 10); |
| 34 | 35 | ||
| 35 | // load an image | 36 | // load an image |
| 36 | image = new Loader(); | 37 | image = new Loader(); |
| 37 | image.load(new URLRequest('http://farm4.static.flickr.com/3053/2572693685_c5a3718e05.jpg')); | 38 | image.load(new URLRequest('http://farm4.static.flickr.com/3053/2572693685_c5a3718e05.jpg')); |
| 38 | 39 | ||
| 39 | // put the image in the panel | 40 | // put the image in the panel |
| 40 | panel.content = image; | 41 | panel.content = image; |
| 41 | 42 | ||
| 42 | // show the panel | 43 | // show the panel |
| 43 | addChild(panel); | 44 | addChild(panel); |
| 44 | } | 45 | } |
| 45 | 46 | ||
| 46 | // on stage resize, update the panel size | 47 | // on stage resize, update the panel size |
| 47 | override protected function draw():void { | 48 | override protected function draw():void { |
| 49 | debug( 'draw '+getTimer()); | ||
| 50 | throw new Error('draw'); | ||
| 48 | panel.setSize(width - 20, height - 20); | 51 | panel.setSize(width - 20, height - 20); |
| 49 | super.draw(); | 52 | super.draw(); |
| 50 | } | 53 | } |
| 51 | } | 54 | } |
| 52 | } | 55 | } |