From: thomas m. <tho...@gm...> - 2006-08-31 09:03:04
|
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 |
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 |
From: Ray C. <rc...@gm...> - 2006-08-31 10:01:06
|
Hi, sorry about that, my mistake. You *have* to use repSizeForClip. On 8/31/06, Ray Chuan <rc...@gm...> wrote: > 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 > -- Cheers, Ray Chuan |
From: Scott H. <sc...@af...> - 2006-08-31 13:07:25
|
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 > > > |
From: thomas m. <tho...@gm...> - 2006-08-31 14:47:52
|
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 ---------------------------------------------------------- |
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 |