From: Ray C. <rc...@gm...> - 2006-08-31 16:19:47
|
It shouldn't matter which clip you pass to repSizeForClip, since the size is not affected by the clip it is attached to. It's a different story for co-ordinates, though. On 8/31/06, thomas mery <tho...@gm...> wrote: > hi > > I was using repSizeForClip(). > > and you're right about _root, I figured it out later. > > It leaves me with my question : > > how do I get the size of the symbol before the draw cycle ? > > because for instance I think If I want to use NSImage.setImageAlignment() > and that I don't set a size for the image (and I want the image to the size > of the symbol) it won't work (since the size() yields widht=undefined and > height=undefined) > > I resort to calling repSizeForClip passing the view mcBounds as the base > clip like : > > var size_mc:MovieClip = > win.rootView().mcBounds().createEmptyMovieClip("__SIZE_MC__",_root.getNextHighestDepth()); > var symbolSize = rep.repSizeForClip(size_mc); > size_mc.removeMovieClip(); > > I also thought about passing the current view to the rep ... > > > > > On 8/31/06, Scott Hyndman <sc...@af...> wrote: > > It's an interesting idea, but there is a problem. You are relying on > > _root to attach the symbol. The symbols may not necessarily be there > > (they could be under a loadMovie'd clip). > > > > Ray is correct in suggesting repSizeForClip(). > > > > Scott > > > > On 31/08/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) > > > > > > 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(); > > > > > > } > > > --- > > > > > > 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 > > > > > > > > > > > > > > ------------------------------------------------------------------------- > > 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 > > > > > > -- > ---------------------------------------------------------- > http://www.myspace.com/thomasmery > http://www.thomas-mery.net > ---------------------------------------------------------- > ------------------------------------------------------------------------- > 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 |