views:

136

answers:

2

I've got an AS3 app making use of the fl.containers.ScrollPane object, and I am setting the source to an SWF file like so:

myMc.scrollContent.source = "assets/something.swf";

When running the application, the SWF is loaded as expected, but both the scrollbars, vertical and horizontal have tiny scroll tacks, that when moved, causes the loaded SWF to completely jump out of view.

It's as if the scrolling region is 10000 x 10000 pixels large.

How can I explicitly set the scroll height and width with code?

A: 

Try to add an event listener for Event.INIT and in the listener update the pane. That should fix it.

something like:

myMc.scrollContent.addEventListener(Event.INIT, updateContent);

function updateContent(event:Event):void{
myMc.scrollContent.update();
}

I haven't tested that. It looks like the the scrollPane doesn't update by it's own.

George Profenza
Thanks for your reply, I gave this a quick try, but it has no effect. I even tried assigning values to scrollContent.verticalScrollBar.maxScrollPosition, but to no avail.
Joe Zephyr
A: 

For some silly reason I tried the following. I went into Flash and opened the FLA for publishing the SWF being loaded. I cut the objects from the stage by Shift selecting and hitting Ctrl + X. Then I hit Ctrl + A to select all, to get rid of any possibly hidden or invisible objects off-stage, and then I pasted in place with Ctrl + Shift + V.

Republished the file, and the problem was fixed.

Joe Zephyr
glad u got it sorted out!
George Profenza