PDA

View Full Version : But what if it DOESN'T?


Goaler
09-11-2004, 03:00 PM
function fillPanel(path)
{
myRoot.attachMovie("scrollpane", "pane", 20000);


myRoot.pane._x = 13;
myRoot.pane._y = 9;
myRoot.pane.setSize(445,315);

myRoot.pane.hScrollPolicy = "off";
myRoot.pane.maxVPosition = 100;

pBar.mode = "polled";
pBar.source = myRoot.pane.content;
pBar._x = 100;
pBar._y = 5;
pBar._visible = true;

myRoot.pane.contentPath = path;

myRoot.pane.addEventListener("complete", myListener);
myListener.complete = function()
{
popup("loaded");
pBar._visible = false;

}



}





OK, this works nearly all of the time. Unfortunately, it gets stuck on some computers and the content doesn't load (which results in an ugly box, out of position and a loader bar that is stuck on X% )

Is there an onLoadError handler for the scrollPane component? How do I use it?

madgett
09-11-2004, 08:38 PM
It takes so many milliseconds of time for the attachMovie() to completely attach to the stage and become available for use. Well in that small delay the rest of the code in your function is being executed. It's trying to format a non-existent scrollpane if you see what I mean. Hopefully in Macromedia's 8Ball (Flash 8) they will resolve this issue.

You need to make your own onAttachComplete(target:Object) function, here is the one I use (slightly modified with your targets):

function fillPanel(path) {
myRoot.attachMovie("scrollpane", "pane", 20000);
trace(myRoot.pane instanceof mx.containers.ScrollPane); // should output false in most situations, but will output true after onAttachComplete() is executed
onAttachComplete(myRoot.pane);
// onAttachComplete(target);
//*****************The Function**********************//
function onAttachComplete(target:Object) {
this.onEnterFrame = function() {
trace(myRoot.pane instanceof mx.containers.ScrollPane);
if (target instanceof mx.containers.ScrollPane) {
trace(target instanceof mx.containers.ScrollPane);
delete this.onEnterFrame;
manipulateScrollPane();
}
};
}
function manipulateScrollPane() {
myRoot.pane._x = 13;
myRoot.pane._y = 9;
myRoot.pane.setSize(445, 315);
myRoot.pane.hScrollPolicy = "off";
myRoot.pane.maxVPosition = 100;
pBar.mode = "polled";
pBar.source = myRoot.pane.content;
pBar._x = 100;
pBar._y = 5;
pBar._visible = true;
myRoot.pane.contentPath = path;
myRoot.pane.addEventListener("complete", myListener);
myListener.complete = function() {
popup("loaded");
pBar._visible = false;
};
}
}


The logic behind onAttachComplete():

The function checks when the ScrollPane component inside the movie clip you're attaching becomes an instance of the ScrollPane class. This can only happen if it exists on the stage. When it evaluates to true then it can legally modify the newly created ScrollPane instance.

Goaler
09-11-2004, 10:34 PM
This always traces "true" for me, and the MC never loads.

(thanks for your effort, maybe I am using it wrong?)


//************************************************** ***
function fillPanel(path)
{

if ( myRoot.pane instanceof mx.containers.ScrollPane )
{
populatePanel(path);
}
else
{
myRoot.attachMovie("scrollpane", "pane", 20000);
populatePanel(path);
}
}


//************************************************** ********************
function populatePanel(path)
{
myRoot.pane._x = 13;
myRoot.pane._y = 9;
myRoot.pane.setSize(445,315);

myRoot.pane.hScrollPolicy = "off";
myRoot.pane.vScrollPolicy = "auto";
myRoot.pane.maxVPosition = 100;

myRoot.pane.contentPath = path;

pBar.mode = "polled";
pBar.source = myRoot.pane.content;
pBar._x = 100;
pBar._y = 5;
pBar._visible = true;
}


This seems to have fixed it, but I don't know if I actually DID anything (grr). I don't like it when code seems to fix itself.

Goaler
09-21-2004, 03:38 PM
That didn't fix it.

Some clients are seeing content outside of the boundries of the scrollPane.

This is unprofessional, and my deadline is in less than a week. Please help!

Goaler
09-21-2004, 04:15 PM
OK, I got this working

function fillPanel(path)
{
myRoot.attachMovie("scrollpane", "pane", 20000);
onAttachComplete(myRoot.pane, path);
}
// onAttachComplete(target);
//*****************The Function**********************
function onAttachComplete(target:Object, path)
{
this.onEnterFrame = function() {
trace(myRoot.pane instanceof mx.containers.ScrollPane);
if (target instanceof mx.containers.ScrollPane) {
trace(target instanceof mx.containers.ScrollPane);
manipulateScrollPane(path);
delete this.onEnterFrame;
}
};
}


function manipulateScrollPane(path)
{
trace(path);
myRoot.pane._x = 13;
myRoot.pane._y = 9;
myRoot.pane.setSize(445, 315);
myRoot.pane.hScrollPolicy = "off";
myRoot.pane.maxVPosition = 100;
pBar.mode = "polled";
pBar.source = myRoot.pane.content;
pBar._x = 100;
pBar._y = 5;
pBar._visible = true;
myRoot.pane.contentPath = path;
myRoot.pane.addEventListener("complete", myListener);
myListener.complete = function() {
popup("loaded");
pBar._visible = false;
};
}


//************************************************** ********************


But I can't duplicate the concern.


I am going to post a new thread asking for beta testers.

Goaler
09-26-2004, 06:04 PM
The flash scrollpane is not professional.


Does anyone know of an aftermarket component that works every time?

(slow connections cause the scrollpane component to load content outside of its boundries... that is totally unacceptable.)