[Flashcoders] MovieClipLoader, onLoadInit: not working properly / bug

2006-10-28 Thread Drew Shefman
I've run into an issue with MovieClipLoader, that I haven't been able to
find an mention of anywhere else online. 

The issue is with the onLoadInit firing before the first frame actionscript
has executed.  The issue was repeatable, but only on specific machines, and
ONLY through the browser. When played in the IDE or EXE then it worked as
expected. I personally was not able to see this error, but it happened
consistently on my client's internal network.

Here is the issue:

The external swf files have AS on frame 1:

//
 var myClass:CustomClass = new CustomClass();
 function getInstance():CustomClass { return myClass;}
/

The main swf has the following:

 var holder_mc:MovieClip
 var myMCL:MovieClipLoader = new MovieClipLoader(); 
 myMCL.addListener(this)

 function onLoadInit(p_target)
 {
var myInst:CustomClass = holder_mc.getInstance();
if (myInst == undefined) 
{
  trace(Error, your file doesn't contain the appropriate class);
}
else
{
//Working as it should
}
}

myMCL.loadClip(myUrl.swf,holder_mc);
/

Now, I know what you are saying... This should work... And it does -
usually... But then I ran into this perplexing problem.

In trying to resolve this issue I did the following:

 private var loadInitInterval:Number;
 private var doLoadInitCount:Number = 0;
 function onLoadInit()
 {
doLoadInit()
 }
 
 function doLoadInit()
 {

clearInterval(loadInitInterval);
var myInst:CustomClass = holder_mc.getInstance();
if (myInst == undefined) 
{
//Let's try waiting for a couple of frames
if (doLoadInitCount  1)
{
trace(Error, your file doesn't contain the appropriate class);
}
else
{
var duration:Number = 1/30*1000 * 2 // wait for 2 frames at
30 fps
clearInterval(loadInitInterval);
loadInitInterval = setInterval(this,doLoadInit, duration)
}
doLoadInitCount++
}
else
{
 //Working as it should
}
 }
///

Setting up the interval, essentially an onEnterFrame, the onLoadInit worked
as it should, where the code in frame 1 of the swf had executed.
I see this as a HUGE ISSUE, in the fact that MovieClipLoader might not be
reliable. 

Has ANYBODY run into this? Or know of what might cause it. We are publishing
to the main swf to v7, external swfs are v6 and v7, and this issue has
appeared when playing back on player 8 and 9. I haven't been able to
duplicate the issue on v7... Actually I haven't been able to duplicate it at
all, but my client has and has consistently. 

I don't expect anybody to really know the answer, because I'm sure that
when/if you try it, it will work as expected. But if you could theorize
about why this might happen... Or what set of circumstances might have
occurred to cause onLoadInit to fail, or execute too early - I'd greatly
appreciate it? 


Thanks for your time!
Cheerio!
Drew Shefman





___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


[Flashcoders] Weird OOP ability... Need a description of why, or at least some documentation

2006-06-01 Thread Drew Shefman
I ran across this really bizarre method access while reviewing someone
else's work.

I would like to look up some documentation for this syntax (it doesn't
have to be AS, it could be some other OOP language - if this is a standard
option that I haven't seen before)... or at least get a description of
why/how it works (other then the obvious - that it does).

Also, can anyone give any good reason to use this syntax?

I'm just confused by it.

Thanks!
Cheerio!
Drew Shefman
[EMAIL PROTECTED]

Notice that it does NOT use static's


class MyTestClass
{
function MyTestClass() {trace (Created)}
public function runTest(){trace(running test)}
}
///
var myInst:MyTestClass = new MyTestClass();
MyTestClass(myInst).runTest();



___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com