hello there,
I like to call a function that is outside of the class file.
for example
main.fla
Calling.asCode:function callmepls(){
trace("yes");
}
Code:package{
public class Calling{
callmepls();
public function Calling(){
}
}
}
Printable View
hello there,
I like to call a function that is outside of the class file.
for example
main.fla
Calling.asCode:function callmepls(){
trace("yes");
}
Code:package{
public class Calling{
callmepls();
public function Calling(){
}
}
}
You need to create another class and make the function public.
package
{
public class Calling
{
public function Calling ():void
{
var cm:Called=new Called();
cm.callmepls ();
}
}
}
package
{
public class Called
{
public function Called ():void
{
}
public function callmepls ():void
{
trace ("yes");
}
}
}
hello cancerinform,
thanks for answering.
Are there no other way? I mean like dispatch an Event in the class file to the main stage and add there an EventListener which opens a function.
Why make it complicated?
k I give you the big picture.
In the first frame I like to load all my xml-data in a unique global variable. I believe those data then are called value object or something.
So the only why to assign something to a global variable in a function can only be done in a class file right?
What I like to do is I want to call a function when the class is finished assigning the xml-data to a global variable.
Put your entire XML-data logic into a class. Typically, this would just be the document class. You could set the entire document class to be public, and then even public static for just that function. Depending on the situation.
Thanks. Document Class is the keyword I needed.Quote:
Originally Posted by MyFriendIsATaco
update??
solved??
i'm trying to finish my preloader's post animation sequence - when it reaches its last frame - i want the document class to initiate "addChild" objects - either by calling a function from the preloader's postanimation class or by passing a variable to the document class to check to see if i can continue with adding objects to the stage...
hi LukewarmSteak
Yeah my problem was actually solved. I forgot to mark it.
And to your problem:
I had the same problem too when I wanted to create a working preloader.
This is how I did it:
My preloader has a "Playing Out Animation" and when it's finished I dispatch an Event (in my case a customevent) to the preloader class file. It calls a function which removes the eventlistener when it's finished it dispatch the Event Complete to the document class.
At this point you can call your addChild function.