|
|
|
Thank you David for your answer.
Yes, the attached SWF was created using Flash but not by me. That's why I could not understand this strange behaviour. It's OK for me to use your suggestion on the second panel as a workaround. Just for my better understanding, do you think this is an expected behaviour for the SWFLoader component or is it really a bug? Thanks Stefano I am not using SWFLoader since Flash 8. But I had same problem before. So, what happened in my code I created SWF 1 and loaded SWF 2 what is bigger then my container. As soon as SWF 2 loaded inside container, some times container changed size or new SWF was over a container holder. I don't remember how I fixed that problem (maybe set _root.lock=true and loaded in background mode or add event listener onLoad for SWFLoader variable) hole idea you have to wait until movie will loaded and after attach to your container. That reason why in your code a second panel working fine.
Does something like the following workaround work for you?
<?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"> <mx:Panel title="Banner goes here" layout="absolute"> <mx:Box id="box2" backgroundColor="red" width="{swfLdr.width}" height="{swfLdr.height}" /> <mx:SWFLoader id="swfLdr" source="Banner.swf" width="468" height="60" mask="{box2}" /> </mx:Panel> </mx:Application> It uses the "mask" property to mask the content which falls outside the SWFLoader instance. Peter Able to repro in 201.3 and latest moxie.
I am using the similar trick as Peter deHaan had suggested to hide everything that is rendered outside of the SWFLoader container borders:
private function applyMask() : void { if (swf != null && swf.content != null && swf.content.loaderInfo.width > 0 && swf.content.loaderInfo.height > 0) { var scaleRatioX : Number = swf.content.loaderInfo.width / this.width; var scaleRatioY : Number = swf.content.loaderInfo.height / (this.height - this.controlBar.height); var scaleRatio : Number = Math.max(scaleRatioX, scaleRatioY); swf.width = swf.content.loaderInfo.width > 0 ? Math.round(swf.content.loaderInfo.width / scaleRatio) : 100; swf.height = swf.content.loaderInfo.height > 0 ? Math.round(swf.content.loaderInfo.height / scaleRatio) : 100; var s : Shape = new Shape(); s.graphics.beginFill(0xFFFFFF); s.graphics.drawRect(0, 0, swf.width, swf.height); s.graphics.endFill(); swf.addChild(s); s.visible = false; swf.mask = s; } } <mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml" resize="applyMask()" > .... <mx:SWFLoader id="swf" complete="applyMask()" source="navigation.swf/> </mx:VBox> Moreover, I reapply "applyMask" every time when I resize the parent mx:VBox container: Not a regression, has workaround. Recommend deferral for Moxie.
I also seem to have this problem but the workarounds given above are not appropriate. I am loading the external swf dynamically using Loader and wish to display it in a Canvas with auto scrollbar behavior. Since, I do want the scrollbar behavior, the mask work-around is not appropriate. Once loaded, the content may be scaled (by user request) and the scrollbars should then appear. The external swf is actually a child of the object which in turn is the child of the scrollable Canvas. I can't wait until the child swf loads to add its parent to the Canvas as David Gofman suggests. Is there another work-around. Perhaps some way to overtly reset the Canvas when the onLoad event signals that the external swf in question has loaded?
Another workaround is setting the scrollRect property, as seen in the following example:
<?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"> <mx:Panel title="Banner goes here" layout="absolute"> <mx:SWFLoader id="swfLdr" source="Banner.swf" width="468" height="60" scrollRect="{new Rectangle(0,0,swfLdr.width,swfLdr.height)}" /> </mx:Panel> </mx:Application> This is a good workaround, so I think we can defer.
Changed Priority, Severity and Discoverability.
Recommend will not fix. Don't want to add clipping to SWFLoader.
Per Alex's recommendation, we probably don't want to add this clipping to SWFLoader. We recommend that you implement the suggestions in previous comments if you run into this bug.
Retiring bug. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
I am sure you created attached SWF file using Flash Application.
Multiple layers, motions all nice Flash features. At same time you specified Stage dimension 470x65. That size applied inside Flash Player window. When you embedded to another SWF your stage properties gone. Your start point x, y, width and height base of your image layout (circles). What are negative by x and y and out of 470 pixels. That reason why Panel 1 displayed all Stage components. For Panel 2 you can apply horizontalScrollPolicy="off" verticalScrollPolicy="off" to get your expected behavior.