Hello Michael,
I have had the same problem and Fabrice is correct, sometimes you must
set RectangleClipping to get a SWF with Away3D objects to load and
display into another SWF. The clipping limits don't seem to be
important (except possibly for performance) - I usually just set them
to very large numbers.
Another common problem with SWF's that crash or won't display properly
when loaded into another SWF is due to the constructor in the loaded
SWF trying to run before the Flash player has finished loading the new
object to the stage. The solution is to put an ADDED_TO_STAGE event
listener at the beginning of the constructor, then do the rest of the
initialization when the event fires. There was a post in this group
about this: "Clipping.screen crashes when using Loader and doc
class" (18 May 2008).
E.g.
public function YourClass(){
addEventListener(Event.ADDED_TO_STAGE, myInit);
}
public function myInit(event:Event){
// Do all the normal constructor stuff here
}
Ralph
On Mar 14, 8:35 am, Fabrice <[email protected]> wrote:
> you're welcome.
>
> btw this snippet coming from my libs wasn't cleaned properly before
> mailing it. The two extra params, offsetX, Y were in my code
> to excenter the view.x/y. by default the view.x, y centers to the
> clipping rect.
> so if you want excenter, just add to this method the missing offsets
> params
>
> _view.x = rect.x+(rect.width * .5)+offsetX;
> _view.y = rect.y+(rect.height * .5)+offsetY;
>
> or just clear the 2 extra params.
>
> Fabrice
>
> On Mar 14, 2009, at 4:10 AM, mikesven wrote:
>
>
>
> > Hi Fabrice,
>
> > I used the setNewClipping method that you showed above and everything
> > is working great now. Thank you very much!
>
> > Thanks,
>
> > Michael
>
> > On Mar 13, 6:37 pm, Fabrice <[email protected]> wrote:
> >> Hey Michael.
> >> Try set the RectangleClipping.
>
> >> here is a little method, you can pass a Rectangle to it.
> >> in this case if its large as the swf,
>
> >> setNewClipping(new Rectangle(0, 340, heightbanner, widthstage));
>
> >> public function setNewClipping(rect:Rectangle,
> >> offsetX:Number = 0,
> >> offsetY:Number = 0):void
> >> {
> >> var rectC:RectangleClipping = new
> >> RectangleClipping({minX:-
> >> (rect.width*.5) ,minY:-(rect.height*.5), maxX:(rect.width*.5), maxY:
> >> (rect.height * .5)});
> >> _view.clipping = rectC;
> >> _view.x = rect.x+(rect.width * .5);
> >> _view.y = rect.y+(rect.height * .5);
> >> }
>
> >> of course you can directly set the RectangleClipping, just think
> >> center of the rectangle instead of the Top left.
>
> >> Hope it helps.
>
> >> Fabrice
>
> >> On Mar 13, 2009, at 10:59 PM, mikesven wrote:
>
> >>> Hi Guys, I have run into a little issue and I was wondering if
> >>> anybody has run into something similar before. I have made a
> >>> group of
> >>> rotating banners using Away3D 2.3.3 and everything seems to be
> >>> working
> >>> fine when this swf is published. The problems occurs when I try to
> >>> load the banner.swf file into my "shell" .swf file using
> >>> flash.display.loader. If the loaded banner swf is placed at 0,0
> >>> in my
> >>> shell.swf file everything is perfect, but as soon as I place it on
> >>> the
> >>> stage where I would like it (x:0 y:340), the banners will not appear
> >>> properly unless I physically scale the shell.swf file while viewing
> >>> it. Does anybody know what might be causing this, or any way to
> >>> correct it?
>
> >>> Thanks for any help that can be offered,
>
> >>> Michael