[haXe] Haxe Bug

Marcus Bergstrom marcus at quickform.net
Thu Dec 14 10:28:21 CET 2006


Hi Aaron,

use flash.MovieClipLoader to load your SWFs.

import flash.MovieClipLoader;
import flash.MovieClip;

var container_mc:MovieClip = flash.Lib.current.createEmptyMovieClip 
("container_mc", flash.Lib.current.getNextHighestDepth());

var a = new MovieClipLoader;
a.addListener(this);
a.loadClip("urlto.swf", container_mc);

function onInit(mc:MovieClip):Void {
	// Your clip is now initialized.
}


If you use attachMovie (to import from the library) the mc will be
initialized immediately.

Hope that helps.

Marcus Bergstrom
marcus at quickform.net



On Dec 13, 2006, at 9:44 PM, Aaron Gray wrote:

> So its a timing problem ?
>
> And I just loop till m_inited is true ?
>
> Is there no better way to achieve this ?
>
> Many thanks,
>
> Aaron
>
> On 12/13/06, Louis-Philippe Maurice <maurice at ndimedia.com> wrote:
> The classic trick is to let a frame pass before you refer the  
> property.
>
> Class Foo
>     extends MovieClip
> {
>     var m_inited:Bool;
>
>     function new()
>     {
>        m_inited = false;
>        this.onEnterFrame = function()
>         {
>           m_inited = true;
>           this.onEnterFrame = null;
>         }
>     }
> }
>
> Aaron Gray wrote:
>> Thats good. I am not at all familuar with ActionScript.
>>
>> So how do I go about initializing 'mc', I cannot find an obvious  
>> method to do this ?
>>
>>
>> On 12/13/06, Louis-Philippe Maurice <maurice at ndimedia.com > wrote:
>> It's not a bug. The same thing happens in the Macromedia app. It's  
>> because the MC's properties haven't been initialized yet.
>>
>>
>> Aaron Gray wrote:
>>> Just found a possible bug in HaXe :-
>>>
>>> import flash.MovieClip;
>>> class Bug {
>>>     static function main() {
>>>         var mc : flash.MovieClip = flash.Lib._root;
>>>
>>>         trace("width = " + mc._width);
>>>         trace("height = " + mc._height);
>>>         trace("width = " + mc._width);
>>>     }
>>> }
>>> This is printing "width" as zero on the first usage but getting  
>>> it correct on the second.
>>>
>>> Aaron
>>>
>>
>>
>> --
>> haXe - an open source web programming language
>> http://haxe.org
>>
>>
>
>
> --
> haXe - an open source web programming language
> http://haxe.org
>
>
> -- 
> haXe - an open source web programming language
> http://haxe.org

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.motion-twin.com/pipermail/haxe/attachments/20061214/8279a566/attachment.htm


More information about the Haxe mailing list