1 /* 2 Copyright aswing.org, see the LICENCE.txt. 3 */ 4 5 import org.aswing.FloorPane; 6 import org.aswing.geom.Dimension; 7 import org.aswing.utils.MCUtils; 8 9 /** 10 * JAttachPane, a container attach flash symbol in library to be its floor. 11 * @see org.aswing.JLoadPane 12 * @author iiley 13 */ 14 class org.aswing.JAttachPane extends FloorPane { 15 16 /** 17 * Event onAttached, when the symbol was attached. 18 * onAttached Event{source:JAttachPane} 19 */ 20 public static var ON_ATTACHED:String = "onAttached"; 21 22 /** 23 * JAttachPane(path:String, prefferSizeStrategy:Number) <br> 24 * JAttachPane(path:String) prefferSizeStrategy default to PREFER_SIZE_BOTH<br> 25 * JAttachPane() path default to null,prefferSizeStrategy default to PREFER_SIZE_BOTH 26 * <p> 27 * Creates a JAttachPane with a path to attach a symbol from library 28 * @param path the linkageID of the symbol in library 29 * @param prefferSizeStrategy the prefferedSize count strategy. Must be one of below: 30 * <ul> 31 * <li>{@link org.aswing.FloorPane#PREFER_SIZE_BOTH} 32 * <li>{@link org.aswing.FloorPane#PREFER_SIZE_IMAGE} 33 * <li>{@link org.aswing.FloorPane#PREFER_SIZE_LAYOUT} 34 * </ul> 35 * @see #setPath() 36 */ 37 public function JAttachPane(path:String, prefferSizeStrategy:Number) { 38 super(path, prefferSizeStrategy); 39 } 40 41 /** 42 * Returns the attached movieclip. 43 * @return the movieclip attached. 44 */ 45 public function getFloorMC():MovieClip{ 46 return floorMC; 47 } 48 49 /** 50 * load the floor content. 51 * <p> here it is empty. 52 * Subclass must override this method to make loading. 53 */ 54 private function loadFloor():Void{ 55 if(MCUtils.isMovieClipExist(floorMC)){ 56 setLoaded(true); 57 revalidate(); 58 } 59 } 60 61 /** 62 * Create the floor mc. 63 * <p> here it is empty. 64 * Subclass must override this method to make creating. 65 */ 66 private function createFloorMC():MovieClip{ 67 if(MCUtils.isMovieClipExist(target_mc)){ 68 floorMC = creater.attachMC(target_mc, getPath(), "floor", getFloorDepth()); 69 setFloorOriginalSize(new Dimension(floorMC._width, floorMC._height)); 70 dispatchEvent(ON_ATTACHED, createEventObj(ON_ATTACHED)); 71 } 72 return floorMC; 73 } 74 } 75