From: Ray C. <rc...@gm...> - 2006-08-31 09:49:03
|
Hi, On 8/31/06, thomas mery <tho...@gm...> wrote: > Helo all, > > I've been finding myself trying to use the size of a symbol representation > before its being drawn, like if I want to use setAlignment on it : > > ---- > var rect:NSRect = new NSRect(30,100,200,200); > var img:NSImage = (new NSImage()).init(); > var rep:ASSymbolImageRep = new ASSymbolImageRep("logo_sm"); > img.addRepresentation(rep); > > var iv:NSImageView = new NSImageView(); > iv.initWithFrame (new NSRect(0,0,300,300)); > > iv.setImage(img); > > iv.setImageAlignment(NSImageAlignment.NSImageAlignTopRight); > > win.contentView().addSubview(iv); > ---- > > since it seem the repSizeForClip method is only called when the rep is drawn > it was not working (the scaledImageFrameForRect of the NSImageCell class > would not get a size for the NSImage) What's the problem exactly? Do you have a size with null values, or a size with zero values? > so I extended ASSymbolImageRep to have the constructor of the child class > look lihe this : > > --- > public function SMSymbolImageRep(symbolName : String, size : NSSize) { > > super(symbolName, size); > > var size_mc:MovieClip = > _root.createEmptyMovieClip("__SIZEMC__",_root.getNextHighestDepth()); > > if(m_size == undefined) { > m_size = repSizeForClip(size_mc); > } > > size_mc.removeMovieClip(); You could have done this: m_size = NSSize.ZeroSize; This would have saved you the trouble of creating and destroying a dummy clip to set the size. > } > --- > > it's working for me so I'm happy :) but I was wondering if woud not be a > useful addition to the ASSymbolImageRep class, and if not then why ? > > Thanks in advance > > thomas > > > > > ------------------------------------------------------------------------- > Using Tomcat but need to do more? Need to support web services, security? > Get stuff done quickly with pre-integrated technology to make your job > easier > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > > _______________________________________________ > actionstep-core mailing list > act...@li... > https://lists.sourceforge.net/lists/listinfo/actionstep-core > > > -- Cheers, Ray Chuan |