Groups | Blog | Home
all groups > flash actionscript > september 2006 >

flash actionscript : PopUpManager.createPopUp()


forumnotifier
9/3/2006 3:42:55 PM
Hey,

I have a movieclip hereforth known as "a" has a class attached to it that
creates a PopUp. When running this movie the PopUp works fine. However when
loading "a" into a movieclip hereforth known as "b"...it doesnt work.

Running a trace on a reference to the PopUp returns as nul when running movie
"b" while a will return a reference.

What would cause the popup to work when running "a" initial yet result in
"null" when loaded into "b"?

Kendall
myIP
9/3/2006 11:18:17 PM
It sounds like a scope issue. Are you using ?_root? anywhere in that class
file? If so that would be an issue that can be fixed by replacing it by ?this?
or ?_parent?. Also how are you creating an instance of this class? Are you
doing it via the symbol or timeline? That would also be a possible problem.
If you post the code it will reveal the problem.
icecappacino
9/4/2006 10:43:42 PM
myIP,

[Q]It sounds like a scope issue. Are you using ?_root? anywhere in that class
file?[/Q]I was using "this" then i started using "_root"[Q]Also how are you
creating an instance of this class? Are you doing it via the symbol or
timeline?[/Q] I'm creating an instance of it from at runtime .It is executed
from within a class's function that is attached to a movieclip. alertWindow
results in null

class ContactForm{
var alertWindow:Object;
....
// show Error
function showError(msg:String, obj:Object, funcName:Function):Void {
if (alertWindow == undefined) {
alertWindow = PopUpManager.createPopUp(_root, RectBorder, true);
trace(this+' - '+alertWindow);
alertWindow._x = this._width/2;
alertWindow._y = this._height/2;
}
var alertPrompt:MovieClip = alertWindow.attachMovie("Alert Compt",
'alertPrompt', 0);
alertPrompt.createAlertProperties(msg, ['OK']);
var promptButton:Button = alertPrompt.buttonOK;
promptButton.onRelease = Delegate.create(obj, funcName);
}


}
AddThis Social Bookmark Button