override MovieClip width?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

override MovieClip width?

jlm@justinfront.net
I was wondering if I can override MovieClip width and how..., I was  
looking at scale9Grid with a MovieClip button and found some code for  
scaleBitmap ( http://www.bytearray.org/?p=118 ).

I have appended code for MovieClip button because I did not know this  
would work and did not see it documented online only bits and pieces,  
but I maybe its common knowledge.

<?xml version="1.0" ?>
<movie version="9">
     <clip id="up_mc" import="up.png"/>
     <clip id="over_mc" import="over.png"/>
     <clip id="down_mc" import="down.png"/>
     <library>
         <clip id="ButtonMovie">
             <frame name="_up">
                 <place id="up_mc" name="_up" depth="1"/>
             </frame>
             <frame name="_over">
                 <place id="over_mc" name="_over" depth="1"/>
             </frame>
             <frame name="_down">
                 <place id="down_mc" name="_down" depth="1"/>
             </frame>
         </clip>
     </library>
     <frame>
     </frame>
</movie>

import flash.display.Stage;
import flash.display.MovieClip;
import flash.Lib;
import flash.events.Event;
import ButtonMovie;
import flash.geom.Rectangle;
class SiteMain
{
     public var _stage:                 MovieClip;
     public static var _this:            SiteMain;
     static function main(){ _this = new SiteMain(); }
     public function new()
     {
         _stage                      = Lib.current;
         var but: ButtonMovie        = new ButtonMovie();
         but.x = but.y = 200;
         but.scale9Grid           = new Rectangle( 5, 5, 10,10 );//  
Not currently working?
         but.scaleX = 10;
         _stage.addChild( but );
     }
}

import flash.display.MovieClip;
import flash.Lib;
import flash.geom.Rectangle;
class ButtonMovie extends MovieClip
{
     public var up_mc    : MovieClip;
     public var down_mc  : MovieClip;
     public var over_mc  : MovieClip;
     public function new()
     {
         super();
         stop();
         buttonMode              = true;
         mouseChildren           = false;
         enabled                 = true;
     }

    ///override public function width(.....???

}

-swf out.swf
-swf-version 9
-main SiteMain
-swf-lib lib.swf
-swf-header 1024:768:25:000000

--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: override MovieClip width?

gershon
is it working at all? are you seeing the movieclip and just cant get it to scale? are the labeled frames working?

from a quick look at the swfmill xml, you might be missing a class name in <clip id="ButtonMovie"> llke class="myPkg.ButtonMovie", package myPkg; class ButtonMovie extends MovieClip....
also i think <library> and <clips> should be inside a <frame> tag like:

<?xml version="1.0" ?>
<movie version="9">
   <frame>
   <library>
   <clip id="up_mc" import="up.png"/>
   <clip id="over_mc" import="over.png"/>
   <clip id="down_mc" import="down.png"/>
       <clip id="ButtonMovie">
           <frame name="_up">
               <place id="up_mc" name="_up" depth="1"/>
           </frame>
           <frame name="_over">
               <place id="over_mc" name="_over" depth="1"/>
           </frame>
           <frame name="_down">
               <place id="down_mc" name="_down" depth="1"/>
           </frame>
       </clip>
   </library>
   </frame>
</movie>

home it helps...

On Sat, Aug 29, 2009 at 9:25 PM, Justin Lawerance Mills <[hidden email]> wrote:
I was wondering if I can override MovieClip width and how..., I was looking at scale9Grid with a MovieClip button and found some code for scaleBitmap ( http://www.bytearray.org/?p=118 ).

I have appended code for MovieClip button because I did not know this would work and did not see it documented online only bits and pieces, but I maybe its common knowledge.

<?xml version="1.0" ?>
<movie version="9">
   <clip id="up_mc" import="up.png"/>
   <clip id="over_mc" import="over.png"/>
   <clip id="down_mc" import="down.png"/>
   <library>
       <clip id="ButtonMovie">
           <frame name="_up">
               <place id="up_mc" name="_up" depth="1"/>
           </frame>
           <frame name="_over">
               <place id="over_mc" name="_over" depth="1"/>
           </frame>
           <frame name="_down">
               <place id="down_mc" name="_down" depth="1"/>
           </frame>
       </clip>
   </library>
   <frame>
   </frame>
</movie>

import flash.display.Stage;
import flash.display.MovieClip;
import flash.Lib;
import flash.events.Event;
import ButtonMovie;
import flash.geom.Rectangle;
class SiteMain
{
   public var _stage:                 MovieClip;
   public static var _this:            SiteMain;
   static function main(){ _this = new SiteMain(); }
   public function new()
   {
       _stage                      = Lib.current;
       var but: ButtonMovie        = new ButtonMovie();
       but.x = but.y = 200;
       but.scale9Grid           = new Rectangle( 5, 5, 10,10 );// Not currently working?
       but.scaleX = 10;
       _stage.addChild( but );
   }
}

import flash.display.MovieClip;
import flash.Lib;
import flash.geom.Rectangle;
class ButtonMovie extends MovieClip
{
   public var up_mc    : MovieClip;
   public var down_mc  : MovieClip;
   public var over_mc  : MovieClip;
   public function new()
   {
       super();
       stop();
       buttonMode              = true;
       mouseChildren           = false;
       enabled                 = true;
   }

  ///override public function width(.....???

}

-swf out.swf
-swf-version 9
-main SiteMain
-swf-lib lib.swf
-swf-header 1024:768:25:000000

--
haXe - an open source web programming language
http://haxe.org


--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: override MovieClip width?

Cauê W.
I have searched a lot for a functionality like this, specially for ui component libs. But no deal, they really don't work since haXe doesn't recognize abc native getters and setters. It can be faked using some kind of a wrapper class for the movieclips, but it really isn't a pretty code, nor will it work on the flash IDE, for example.
The only option I found is to either generate an swf that extends movieclip and overrides all getters and setters for function calls, and have them working as a --swf-lib , or to generate the code to as3 native code.

Nicolas says it will be fixed when haXe will support swc input

2009/8/30 gershon <[hidden email]>
is it working at all? are you seeing the movieclip and just cant get it to scale? are the labeled frames working?

from a quick look at the swfmill xml, you might be missing a class name in <clip id="ButtonMovie"> llke class="myPkg.ButtonMovie", package myPkg; class ButtonMovie extends MovieClip....
also i think <library> and <clips> should be inside a <frame> tag like:


<?xml version="1.0" ?>
<movie version="9">
   <frame>
   <library>

   <clip id="up_mc" import="up.png"/>
   <clip id="over_mc" import="over.png"/>
   <clip id="down_mc" import="down.png"/>
       <clip id="ButtonMovie">
           <frame name="_up">
               <place id="up_mc" name="_up" depth="1"/>
           </frame>
           <frame name="_over">
               <place id="over_mc" name="_over" depth="1"/>
           </frame>
           <frame name="_down">
               <place id="down_mc" name="_down" depth="1"/>
           </frame>
       </clip>
   </library>
   </frame>
</movie>

home it helps...


On Sat, Aug 29, 2009 at 9:25 PM, Justin Lawerance Mills <[hidden email]> wrote:
I was wondering if I can override MovieClip width and how..., I was looking at scale9Grid with a MovieClip button and found some code for scaleBitmap ( http://www.bytearray.org/?p=118 ).

I have appended code for MovieClip button because I did not know this would work and did not see it documented online only bits and pieces, but I maybe its common knowledge.

<?xml version="1.0" ?>
<movie version="9">
   <clip id="up_mc" import="up.png"/>
   <clip id="over_mc" import="over.png"/>
   <clip id="down_mc" import="down.png"/>
   <library>
       <clip id="ButtonMovie">
           <frame name="_up">
               <place id="up_mc" name="_up" depth="1"/>
           </frame>
           <frame name="_over">
               <place id="over_mc" name="_over" depth="1"/>
           </frame>
           <frame name="_down">
               <place id="down_mc" name="_down" depth="1"/>
           </frame>
       </clip>
   </library>
   <frame>
   </frame>
</movie>

import flash.display.Stage;
import flash.display.MovieClip;
import flash.Lib;
import flash.events.Event;
import ButtonMovie;
import flash.geom.Rectangle;
class SiteMain
{
   public var _stage:                 MovieClip;
   public static var _this:            SiteMain;
   static function main(){ _this = new SiteMain(); }
   public function new()
   {
       _stage                      = Lib.current;
       var but: ButtonMovie        = new ButtonMovie();
       but.x = but.y = 200;
       but.scale9Grid           = new Rectangle( 5, 5, 10,10 );// Not currently working?
       but.scaleX = 10;
       _stage.addChild( but );
   }
}

import flash.display.MovieClip;
import flash.Lib;
import flash.geom.Rectangle;
class ButtonMovie extends MovieClip
{
   public var up_mc    : MovieClip;
   public var down_mc  : MovieClip;
   public var over_mc  : MovieClip;
   public function new()
   {
       super();
       stop();
       buttonMode              = true;
       mouseChildren           = false;
       enabled                 = true;
   }

  ///override public function width(.....???

}

-swf out.swf
-swf-version 9
-main SiteMain
-swf-lib lib.swf
-swf-header 1024:768:25:000000

--
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