PDA

View Full Version : Window.contenPath in .as class


f13o
10-18-2005, 03:06 PM
I made a PopUp class and in consturctor thereis reference to a contentPath to item inlibrary, but ActionScript doesn't seem to search there... It worked when code was inside .swf file while I was testing this....


import mx.managers.PopUpManager;
import mx.containers.Window;
import mx.controls.Button;

class PopUp {

public var win:MovieClip;
public var answer:Boolean;

private var initObject;
private var cPath = "popup"; // library item
private var yes_btn:Button;
private var no_btn:Button;


function PopUp(parent:Object) {

initObject = {title:"Завршетак теста?", contentPath: cPath, closeButton:true};

win = PopUpManager.createPopUp(MovieClip(parent), Window, true, initObject)
....


I have tried and other "solutions", like attachMovie() to a movieclip and then referencing to it via contentPath, but - no...

Help?

f13o
10-19-2005, 08:23 AM
Is this parametar a String? Or, how to tell him not to load external clip, but rather library item wiht linkage name as parametar?

f13o
10-19-2005, 08:46 AM
I had set Linkage name for my item (i wanted to load into window), and Export for AS, but i unchecked Export in First Frame. That was BAD! I have to put lib. item somewhere before i want to use it via contentPath... Sure i should have figured it out faster...

f13o
10-19-2005, 08:49 AM
The problem is you have to export library item properly. Or - have it exported for ActionScript and in first frame; Or - (if not exported in first frame) have it instanced somewhere on stage before usage...

Problem solved! by me :D

f13o
10-19-2005, 10:13 AM
This should give me reference to the root movie clip in Window instance?

But this part of code is not working:


...
win = PopUpManager.createPopUp(tParent, Window, true, initObject)

// this working
win.setSize(250,200);
win.move(640/2 - win._width/2, 480/2 - win._height/2);
win.startDragging = function(){};

//this trace is returnig undefined
trace ("win: " + win.content);
...


help?