[mtasc] loadMovie bug in MTASC?

Chris Hill ubergeek at ubergeek.tv
Mon Aug 29 04:28:15 CEST 2005


Sorry, I did exactly what you said in steps 1-3, but on 3 
HelloB-mtasc.swf loaded fine. I imagine your problem is probably 
somewhere else. If you like, email me off-list and I'll send you my files.

Chris


Benjamin C. Allfree wrote:

>Hello list, 
>
>There is really a bug here, and I have more info. Please lend your
>expertise.
>
>PROBLEM:
>A MovieClip instance can use loadMovie() to load an mtasc-compiled child
>movie once, but will not load another when called a second time. If the
>child movies are compiled with MX2004, everything works fine.
>
>
>                |Hello-MTASC  | Hello-MX
>                |-------------|---------
> Loader         |     Bug     |   Works
>
>
>STEPS TO REPRODUCE:
>
>See source code below for reference.
>
>1) Modify Hello.as to read "Hello version A". Compile with MTASC, output as
>HelloA-mtasc.swf.
>2) Now make a "Hello verison B" swf, output as HelloB-mtasc.swf
>3) Build Loader.fla and observe that HelloB-mtasc.swf will never load.
>4) Now build two versions of Hello.fla, just like steps #1 and #2. Output as
>HelloA-mx2004.swf and HelloB-mx2004.swf
>5) Modify Loader.fla to load these instead. 
>6) Build and run Loader.fla and observe that HelloB-mx2004.swf now loads.
>
>
>SOURCE CODE:
>
>Loader.fla
>----------
>this.createEmptyMovieClip("logo_mc", this.getNextHighestDepth());
>logo_mc.createEmptyMovieClip("container_mc",0);
>logo_mc.container_mc.loadMovie("HelloA-mtasc.swf");
>logo_mc.onPress = function() {
>	logo_mc.container_mc.removeMovieClip();
>	logo_mc.createEmptyMovieClip("container_mc",0);
>	logo_mc.container_mc.loadMovie("HelloB-mtasc.swf");
>	trace("It works");
>};
>
>
>Hello.fla
>---------
>var m1 = this.createEmptyMovieClip("tester", this.getNextHighestDepth());
>m1.createTextField("tf",0,0,0,800,600);
>m1.tf.text = "Hello version A";
>m1.tf.backgroundColor = 0xff0000;
>m1.tf.background = true;
>
>
>Hello.as
>--------
>class Hello
>{
>	static function main(mc)
>	{
>		var m1 = mc.createEmptyMovieClip("tester",
>			mc.getNextHighestDepth());
>		m1.createTextField("tf",0,0,0,400,20);
>		m1.tf.text = "Hello version A";
>		m1.tf.backgroundColor = 0xff0000;
>		m1.tf.background = true;
>	}
>}
>
>Ben
>805-403-2380
>484-377-1830 (FAX)
>www.benallfree.com 
> 
> 
> 
>
>  
>
>>-----Original Message-----
>>From: Benjamin C. Allfree [mailto:benles at bldigital.com]
>>Sent: Monday, August 01, 2005 5:53 PM
>>To: 'mtasc at lists.motion-twin.com'
>>Subject: loadMovie bug in MTASC?
>>
>>Hi, sorry to bother the dev list with this, but I'm out of other
>>conclusions.
>>
>>I have hello.swf and loader.swf. hello.swf compiled with MTASC will not
>>load in loader.swf compiled with MTASC, but all other combinations work.
>>
>>class Hello
>>{
>>	static function main(mc)
>>	{
>>		var m1 = _root.createEmptyMovieClip("hello",
>>			_root.getNextHighestDepth());
>>		m1.createTextField("tf",0,0,0,800,600);
>>		m1.tf.text = "Hello world !";
>>	}
>>}
>>
>>class Loader
>>{
>>	static function main(mc)
>>	{
>>		var m1 = _root.createEmptyMovieClip("loader",
>>			_root.getNextHighestDepth());
>>		m1.loadMovie("hello.swf");
>>	}
>>}
>>
>>To clarify, the test matrix looks like this:
>>
>>               |Hello-MTASC  | Hello-MX
>>               |-------------|---------
>>Loader-MTASC   |      N      |     Y
>>Loader-MX      |      Y      |     Y
>>
>>Any ideas?
>>
>>Ben
>>805-403-2380
>>484-377-1830 (FAX)
>>www.benallfree.com
>>
>>
>>
>>
>>    
>>
>>>-----Original Message-----
>>>From: mtasc-bounces at lists.motion-twin.com [mailto:mtasc-
>>>bounces at lists.motion-twin.com] On Behalf Of mtasc-request at lists.motion-
>>>twin.com
>>>Sent: None
>>>To: mtasc at lists.motion-twin.com
>>>Subject: mtasc Digest, Vol 11, Issue 1
>>>
>>>Send mtasc mailing list submissions to
>>>	mtasc at lists.motion-twin.com
>>>
>>>To subscribe or unsubscribe via the World Wide Web, visit
>>>	http://lists.motion-twin.com/mailman/listinfo/mtasc
>>>or, via email, send a message with subject or body 'help' to
>>>	mtasc-request at lists.motion-twin.com
>>>
>>>You can reach the person managing the list at
>>>	mtasc-owner at lists.motion-twin.com
>>>
>>>When replying, please edit your Subject line so it is more specific
>>>than "Re: Contents of mtasc digest..."
>>>
>>>
>>>Today's Topics:
>>>
>>>   1. Re:  Intrinsic  Generation (Ralf Bokelberg)
>>>   2.  optimization (Bent Rasmussen)
>>>   3. Re:  Intrinsic Generation (martin heidegger)
>>>   4. Re:  Intrinsic Generation (Ralf Bokelberg)
>>>   5. Re:  optimization (Nicolas Cannasse)
>>>   6. Re:  optimization (Bent Rasmussen)
>>>   7.  // private methods in interface (David Linse)
>>>   8. Re:  optimization (David Rorex)
>>>   9.  [hamtasc] new options: list of includes and intrinsic
>>>      creation (Ralf Bokelberg)
>>>  10. Re:  [hamtasc] new options: list of includes and intrinsic
>>>      creation (martin heidegger)
>>>  11.  this keyword in onLoad event methods (Jason Hanson)
>>>
>>>
>>>----------------------------------------------------------------------
>>>
>>>Message: 1
>>>Date: Sat, 30 Jul 2005 00:32:08 +0200
>>>From: Ralf Bokelberg <info at bokelberg.de>
>>>Subject: Re: [mtasc] Intrinsic  Generation
>>>To: MotionTwin ActionScript2 Compiler List
>>>	<mtasc at lists.motion-twin.com>
>>>Message-ID: <42EAAE68.6090809 at bokelberg.de>
>>>Content-Type: text/plain; charset=us-ascii; format=flowed
>>>
>>>You could create a component from your package using the flash ide.
>>>Cheers,
>>>Ralf.
>>>
>>>Martin Heidegger wrote:
>>>
>>>      
>>>
>>>>Okay where to start:
>>>>I need to create for a folder(with many subfolders) a .swf that
>>>>contains all them. And i need to have a folder that contains all the
>>>>intrinsic definitions. Of course i could write a parser for generating
>>>>intrinsics but that has already been done of you great guys ;)
>>>>
>>>>Would it be much work to integrate a -intrinsic <path> parameter that
>>>>creates the compiled files as intrinsic construct in the directory?
>>>>
>>>>yours Martin.
>>>>--
>>>>MTASC : no more coffee break while compiling
>>>>        
>>>>
>>>------------------------------
>>>
>>>Message: 2
>>>Date: Sat, 30 Jul 2005 00:38:44 +0200
>>>From: "Bent Rasmussen" <exo at bent-rasmussen.info>
>>>Subject: [mtasc] optimization
>>>To: "MotionTwin ActionScript2 Compiler List"
>>>	<mtasc at lists.motion-twin.com>
>>>Message-ID: <001501c5948e$476f71c0$0200000a at pc>
>>>Content-Type: text/plain; format=flowed; charset="iso-8859-1";
>>>	reply-type=response
>>>
>>>Does MTASC perform any optimizations that MMC does not? Does it or will
>>>      
>>>
>>it
>>    
>>
>>>be able to inline? The compile speed is of course impressive in and of
>>>itself.
>>>
>>>/OT is there any SWF compiler capable of inlining in certain cases?
>>>
>>>Bent
>>>
>>>
>>>
>>>------------------------------
>>>
>>>Message: 3
>>>Date: Sat, 30 Jul 2005 07:00:49 +0200
>>>From: martin heidegger <mastakaneda at gmail.com>
>>>Subject: Re: [mtasc] Intrinsic Generation
>>>To: MotionTwin ActionScript2 Compiler List
>>>	<mtasc at lists.motion-twin.com>
>>>Message-ID: <c7d0744705072922002d52f50c at mail.gmail.com>
>>>Content-Type: text/plain; charset=ISO-8859-1
>>>
>>>@bokel r-u talking about as2lib-reflections? (would be far too slow)
>>>@steve I would enjoy practising mono a little. But I think the
>>>important part (parsing) is already done by mtasc and there its pretty
>>>stable. My ruby knowledge is poor - really poor. At least to poor to
>>>use mtasc source and create it for myself.
>>>
>>>yours
>>>Martin.
>>>
>>>
>>>2005/7/30, Ralf Bokelberg <info at bokelberg.de>:
>>>      
>>>
>>>>You could create a component from your package using the flash ide.
>>>>Cheers,
>>>>Ralf.
>>>>
>>>>Martin Heidegger wrote:
>>>>
>>>>        
>>>>
>>>>>Okay where to start:
>>>>>I need to create for a folder(with many subfolders) a .swf that
>>>>>contains all them. And i need to have a folder that contains all the
>>>>>intrinsic definitions. Of course i could write a parser for
>>>>>          
>>>>>
>>generating
>>    
>>
>>>>>intrinsics but that has already been done of you great guys ;)
>>>>>
>>>>>Would it be much work to integrate a -intrinsic <path> parameter
>>>>>          
>>>>>
>>that
>>    
>>
>>>>>creates the compiled files as intrinsic construct in the directory?
>>>>>
>>>>>yours Martin.
>>>>>--
>>>>>MTASC : no more coffee break while compiling
>>>>>          
>>>>>
>>>>--
>>>>MTASC : no more coffee break while compiling
>>>>
>>>>        
>>>>
>>>------------------------------
>>>
>>>Message: 4
>>>Date: Sun, 30 Oct 2005 07:31:34 +0100
>>>From: Ralf Bokelberg <info at bokelberg.de>
>>>Subject: Re: [mtasc] Intrinsic Generation
>>>To: martin heidegger <mastakaneda at gmail.com>,	MotionTwin
>>>      
>>>
>ActionScript2
>  
>
>>>	Compiler List <mtasc at lists.motion-twin.com>
>>>Message-ID: <436468C6.2080303 at bokelberg.de>
>>>Content-Type: text/plain; charset=us-ascii; format=flowed
>>>
>>>No, i ment you create a component from your classes and extract the
>>>intrinsic classes from the resulting swc.
>>>
>>>Cheers,
>>>Ralf.
>>>
>>>
>>>martin heidegger wrote:
>>>
>>>      
>>>
>>>>@bokel r-u talking about as2lib-reflections? (would be far too slow)
>>>>@steve I would enjoy practising mono a little. But I think the
>>>>important part (parsing) is already done by mtasc and there its pretty
>>>>stable. My ruby knowledge is poor - really poor. At least to poor to
>>>>use mtasc source and create it for myself.
>>>>
>>>>yours
>>>>Martin.
>>>>
>>>>
>>>>2005/7/30, Ralf Bokelberg <info at bokelberg.de>:
>>>>
>>>>        
>>>>
>>>>>You could create a component from your package using the flash ide.
>>>>>Cheers,
>>>>>Ralf.
>>>>>
>>>>>Martin Heidegger wrote:
>>>>>
>>>>>
>>>>>          
>>>>>
>>>>>>Okay where to start:
>>>>>>I need to create for a folder(with many subfolders) a .swf that
>>>>>>contains all them. And i need to have a folder that contains all the
>>>>>>intrinsic definitions. Of course i could write a parser for
>>>>>>            
>>>>>>
>>generating
>>    
>>
>>>>>>intrinsics but that has already been done of you great guys ;)
>>>>>>
>>>>>>Would it be much work to integrate a -intrinsic <path> parameter that
>>>>>>creates the compiled files as intrinsic construct in the directory?
>>>>>>
>>>>>>yours Martin.
>>>>>>--
>>>>>>MTASC : no more coffee break while compiling
>>>>>>            
>>>>>>
>>>>>--
>>>>>MTASC : no more coffee break while compiling
>>>>>
>>>>>          
>>>>>
>>>>--
>>>>MTASC : no more coffee break while compiling
>>>>        
>>>>
>>>------------------------------
>>>
>>>Message: 5
>>>Date: Sat, 30 Jul 2005 10:10:28 +0200
>>>From: "Nicolas Cannasse" <ncannasse at motion-twin.com>
>>>Subject: Re: [mtasc] optimization
>>>To: "MotionTwin ActionScript2 Compiler List"
>>>	<mtasc at lists.motion-twin.com>
>>>Message-ID: <007001c594de$2748a510$0100a8c0 at warp>
>>>Content-Type: text/plain;	charset="iso-8859-1"
>>>
>>>      
>>>
>>>>Does MTASC perform any optimizations that MMC does not? Does it or
>>>>        
>>>>
>>will
>>    
>>
>>>it
>>>      
>>>
>>>>be able to inline? The compile speed is of course impressive in and of
>>>>itself.
>>>>
>>>>/OT is there any SWF compiler capable of inlining in certain cases?
>>>>
>>>>Bent
>>>>        
>>>>
>>>Look at this thread :
>>>http://lists.motion-twin.com/archives/mtasc/2005-June/003121.html about
>>>issues with inlining.
>>>
>>>Nicolas
>>>
>>>
>>>
>>>------------------------------
>>>
>>>Message: 6
>>>Date: Sat, 30 Jul 2005 11:48:24 +0200
>>>From: "Bent Rasmussen" <exo at bent-rasmussen.info>
>>>Subject: Re: [mtasc] optimization
>>>To: "MotionTwin ActionScript2 Compiler List"
>>>	<mtasc at lists.motion-twin.com>
>>>Message-ID: <000401c594eb$d4e61100$0200000a at pc>
>>>Content-Type: text/plain; format=flowed; charset="iso-8859-1";
>>>	reply-type=original
>>>
>>>I had a quick look through it. Now, here's what I had in mind
>>>
>>>class mat {
>>> static function lerp(k: Number, a: Number, b: Number): Number {
>>>  return a + k*(b - a)
>>> }
>>>
>>> private function mat() {
>>>  // no instantiation possible
>>> }
>>>}
>>>
>>>The class cannot be instantiated. There is no object to protect from
>>>dynamics. So allright, you could create a subclass.
>>>
>>>dynamic class mat2 extends mat {
>>> function mat2() {
>>>  lerp = null
>>> }
>>>}
>>>
>>>This screws up in MMC. But if perhaps the first class is augmented
>>>
>>>/* MTASC[final] */ class mat {
>>>
>>>Anyway, if there is a -O flag for (dangerous) optimizations then people
>>>could opt-in for the consequences.
>>>
>>>Do none of the C# SWF compilers offer limited inlining?
>>>
>>>But bottomline, a preprocessor would be good enough. Anyone working on
>>>      
>>>
>>it?
>>    
>>
>>>:-)
>>>
>>>Bent
>>>
>>>      
>>>
>>>>>Does MTASC perform any optimizations that MMC does not? Does it or
>>>>>          
>>>>>
>>will
>>    
>>
>>>>>it
>>>>>be able to inline? The compile speed is of course impressive in and
>>>>>          
>>>>>
>>of
>>    
>>
>>>>>itself.
>>>>>
>>>>>/OT is there any SWF compiler capable of inlining in certain cases?
>>>>>
>>>>>Bent
>>>>>          
>>>>>
>>>>Look at this thread :
>>>>http://lists.motion-twin.com/archives/mtasc/2005-June/003121.html
>>>>        
>>>>
>>about
>>    
>>
>>>>issues with inlining.
>>>>
>>>>Nicolas
>>>>
>>>>--
>>>>MTASC : no more coffee break while compiling
>>>>
>>>>        
>>>>
>>>
>>>------------------------------
>>>
>>>Message: 7
>>>Date: Sat, 30 Jul 2005 15:44:20 +0200
>>>From: David Linse <elplinso at yahoo.de>
>>>Subject: [mtasc] // private methods in interface
>>>To: mtasc at lists.motion-twin.com
>>>Message-ID: <42EB8434.5000505 at yahoo.de>
>>>Content-Type: text/plain; charset=UTF-8; format=flowed
>>>
>>>
>>>hi there..
>>>
>>>i found a little thing as i worked with interfaces.
>>>
>>>example code:
>>>
>>>interface com.domain.Foo()
>>>{
>>>	private function _onEvent() : Void;
>>>}
>>>
>>>mtasc:
>>>- does not throw an error when you define a private method in it,
>>>or outputs anything
>>>
>>>mmc:
>>>- does
>>>...Only the public attribute is allowed for interface methods.
>>>    private function _onEvent() : Void; ...
>>>
>>>
>>>is this wanted ?
>>>
>>>
>>>btw:
>>>
>>>if the return-type is 'Void' and you change it in the
>>>implementing class, youB4ll get an error as expected.
>>>
>>>but if you remove the type (in the interface), then there is no error
>>>thrown.
>>>this happens in both compilers. but is this some kind of 'flexibility' ?
>>>;)
>>>
>>>imho 'no return type' means that 'nothing is returned' and should
>>>invoke an compiler error about wrong implementation of the interface. or
>>>not ?
>>>
>>>regards
>>>
>>>david
>>>
>>>
>>>
>>>------------------------------
>>>
>>>Message: 8
>>>Date: Sat, 30 Jul 2005 11:05:51 -0700
>>>From: David Rorex <drorex at gmail.com>
>>>Subject: Re: [mtasc] optimization
>>>To: MotionTwin ActionScript2 Compiler List
>>>	<mtasc at lists.motion-twin.com>
>>>Message-ID: <d3b4045505073011051f9e96b at mail.gmail.com>
>>>Content-Type: text/plain; charset=ISO-8859-1
>>>
>>>On 7/30/05, Bent Rasmussen <exo at bent-rasmussen.info> wrote:
>>>      
>>>
>>>>But bottomline, a preprocessor would be good enough. Anyone working on
>>>>        
>>>>
>>>it?
>>>      
>>>
>>>>:-)
>>>>        
>>>>
>>>There's no reason you couldn't use the C preprocessor (cpp) on your
>>>.as files. You could automate it using Make or Ant or similar tools.
>>>This would give you #include, #defines, macros, etc.
>>>
>>>Tip: Use the -P flag to suppress line marking which is not valid in
>>>.as files, and use -C to preserve comments if you want.
>>>
>>>-David R
>>>
>>>
>>>------------------------------
>>>
>>>Message: 9
>>>Date: Mon, 01 Aug 2005 14:46:15 +0200
>>>From: Ralf Bokelberg <info at bokelberg.de>
>>>Subject: [mtasc] [hamtasc] new options: list of includes and intrinsic
>>>	creation
>>>To: Open Source Flash Mailing List <osflash at osflash.org>,	MotionTwin
>>>	ActionScript2 Compiler List <mtasc at lists.motion-twin.com>
>>>Message-ID: <42EE1997.1070504 at bokelberg.de>
>>>Content-Type: text/plain; charset=us-ascii; format=flowed
>>>
>>>The latest additions to the hacked mtasc are
>>>
>>>-rb_intrinsic_out_path <dir> : creates intrinsics of all classes seen
>>>during the compile and write them to dir
>>>
>>>-rb_list_included_classes : lists included classes to stdout
>>>
>>>Cheers,
>>>Ralf.
>>>
>>>
>>>
>>>
>>>------------------------------
>>>
>>>Message: 10
>>>Date: Mon, 1 Aug 2005 15:12:31 +0200
>>>From: martin heidegger <mastakaneda at gmail.com>
>>>Subject: Re: [mtasc] [hamtasc] new options: list of includes and
>>>	intrinsic	creation
>>>To: MotionTwin ActionScript2 Compiler List
>>>	<mtasc at lists.motion-twin.com>
>>>Message-ID: <c7d07447050801061212843677 at mail.gmail.com>
>>>Content-Type: text/plain; charset=ISO-8859-1
>>>
>>>nice ...
>>>
>>>2005/8/1, Ralf Bokelberg <info at bokelberg.de>:
>>>      
>>>
>>>>The latest additions to the hacked mtasc are
>>>>
>>>>-rb_intrinsic_out_path <dir> : creates intrinsics of all classes seen
>>>>during the compile and write them to dir
>>>>
>>>>-rb_list_included_classes : lists included classes to stdout
>>>>
>>>>Cheers,
>>>>Ralf.
>>>>
>>>>
>>>>--
>>>>MTASC : no more coffee break while compiling
>>>>
>>>>        
>>>>
>>>------------------------------
>>>
>>>Message: 11
>>>Date: Mon, 01 Aug 2005 12:03:51 -0500
>>>From: "Jason Hanson" <jayfour000 at hotmail.com>
>>>Subject: [mtasc] this keyword in onLoad event methods
>>>To: mtasc at lists.motion-twin.com
>>>Cc: jasonh at touchwood.net
>>>Message-ID: <BAY16-F24C06E296FE86C4375A06283C30 at phx.gbl>
>>>Content-Type: text/plain; format=flowed
>>>
>>>[CODE]
>>>import com.bjc.controls.TextInput;
>>>class NavMenu0 extends MovieClip{
>>>// props
>>>public var zoom_txti:TextInput;
>>>
>>>/**
>>>* Constructor
>>>*/
>>>function NavMenu0(){
>>>		trace("NavMenu0 constructor called.");
>>>		init();
>>>	}
>>>
>>>	/**
>>>	 * Initilization Method
>>>	 */
>>>private function init():Void{
>>>// Create a local reference to the current class.
>>>var thisObj:NavMenu0 = this;
>>>// some generic Number for this example
>>>var myNum:Number = 10;
>>>
>>>// syntax 1
>>>zoom_txti.onLoad = function(){
>>>	thisObj.zoom_txti.text = myNum; // Type error. Number should be
>>>String,
>>>this is expected.
>>>}
>>>
>>>//syntax 2
>>>zoom_txti.onLoad = function(){
>>>	this.zoom_txti.text = myNum; // No error. This is where I think
>>>there
>>>should be a type error, but there is no error.
>>>}
>>>
>>>//syntax 3
>>>zoom_txti.onLoad = function(){
>>>	thisObj.zoom_txti.text = String(myNum); // No error.  This is
>>>expected.
>>>}
>>>}
>>>}
>>>[/CODE]
>>>
>>>When I use "this" in an onLoad method to refer to the component instance
>>>that the onLoad method is attached to type checking is circumvented.
>>>However, when I use the actual instance name of the component type
>>>checking
>>>correctly shows an error.  The number needs to be cast as a String to be
>>>completely correct.  (I know that casting to String, Number, Boolean,
>>>Data,
>>>and Array have problems, but in this case the casting syntax gets the
>>>      
>>>
>>job
>>    
>>
>>>done ... even if it is not truly casting the Number as a String and is
>>>      
>>>
>>in
>>    
>>
>>>fact doing a data conversion...)
>>>
>>>Does using "this" by default circumvent type checking in this instance,
>>>      
>>>
>>or
>>    
>>
>>>would it be possible to have the MTASC compiler apply type checking to
>>>      
>>>
>>the
>>    
>>
>>>component instance referred to as "this"?  It is entirely possible that
>>>      
>>>
>>I
>>    
>>
>>>have am missing a core OO concept here, so please let me know if I am
>>>off-base with this.
>>>
>>>Thanks
>>>
>>>--jason
>>>
>>>
>>>
>>>
>>>------------------------------
>>>
>>>_______________________________________________
>>>mtasc mailing list
>>>mtasc at lists.motion-twin.com
>>>http://lists.motion-twin.com/mailman/listinfo/mtasc
>>>
>>>
>>>End of mtasc Digest, Vol 11, Issue 1
>>>************************************
>>>      
>>>
>
>--
>MTASC : no more coffee break while compiling
>  
>

-- 
 _________________________________________
<   __ __  ____                           >
<  |  |  \/ ___\  Chris Hill              >
<  |  |  / /_/  > ubergeek at ubergeek.tv    >
<  |____/\___  /  http://ubergeek.tv      >
<       /_____/   The Smell of Geek!      >
<----------------------------------------->




More information about the mtasc mailing list