Re: [Flashcoders] Loading MC

2009-04-05 Thread Hans Wichman
Hi Karl,

your best bet is probably to checkout the imageloader source from martijn de
visser that you are using, and adapt that to be able to get at the values
you want.

Maybe this works:
 target._width = target._width / 3;
 target._height = target._height / 3;
 _root.stage_mc[LargePic + ID].previewW = target._width;
 _root.stage_mc[LargePic + ID].previewH = target._height;

regards,
JC

On Fri, Apr 3, 2009 at 12:03 PM, Karl DeSaulniers k...@designdrumm.comwrote:

 Hello,
 I was wondering if anyone can point me in the rigth direction.

 I have been trying for days now to figure this out.
 I know there is some little thing I am missing
 and its probably right under my nose so to speak.

 Here is my code:

 //--
 // Start Image loader
 //--

 import com.martijndevisser.ImageLoader;

 _root.stage_mc.attachMovie(LargePic,LargePic +
 ID,this.getNextHighestDepth());
 _root.stage_mc[LargePic + ID].ID = ID;
 _root.stage_mc[LargePic + ID]._x = originalX;
 _root.stage_mc[LargePic + ID]._y = originalY;
 var mcProgress:Number = 0;

 var checkLoader:Object = new Object();
 checkLoader.onLoadStart = function(target:MovieClip):Void  {
trace(Start Width: + _root.stage_mc[LargePic + ID].previewW);
trace(Start Height: + _root.stage_mc[LargePic + ID].previewH);
_root.stage_mc[LargePic + ID].newPic.spiralLoader._visible = true;
_root.stage_mc[LargePic + ID].newPic.spiralLoader.gotoAndPlay(2);
 };
 checkLoader.onLoadComplete = function(target:MovieClip) {
target = _root.stage_mc[LargePic + ID].newPic.Image_mc;
_root.stage_mc[LargePic + ID].newPic.percentCom.text = ;
_root.stage_mc[LargePic + ID].newPic.spiralLoader.stop();
_root.stage_mc[LargePic + ID].newPic.spiralLoader.gotoAndStop(1);
_root.stage_mc[LargePic + ID].newPic.spiralLoader._visible =
 false;
target._width = target._width / 3;
target._height = target._height / 3;
_root.stage_mc[LargePic + ID].previewW = _root.stage_mc[LargePic
 + ID].newPic._width;
_root.stage_mc[LargePic + ID].previewH = _root.stage_mc[LargePic
 + ID].newPic._height;
trace(End Width: + _root.stage_mc[LargePic + ID].previewW);
trace(End Height: + _root.stage_mc[LargePic + ID].previewH);
 };
 checkLoader.onLoadProgress = function(target:MovieClip, bytesLoaded:Number,
 bytesTotal:Number):Void  {
mcProgress = Math.ceil((bytesLoaded / bytesTotal) * 100);
_root.stage_mc[LargePic + ID].newPic.percentCom.text =
 mcProgress.toString() + %;
 };
 var loader:ImageLoader = new ImageLoader(_root.stage_mc[LargePic +
 ID].newPic.Image_mc);
 loader.addListener(checkLoader);
 loader.loadImage(_global.projectPic,_root.stage_mc[LargePic +
 ID].newPic.Image_mc);

 //--
 // End Image Loader
 //--


 To explain further, I have a oversized image loading at first which is
 sized down 3 times.
 Once it sizes down, I want previewW and previewH to equal the new width and
 height.
 Everything loads fine, it loads and the progress runs and it resizes fine,
 but when I hit my resize button to make it smaller, the variables previewW
 and previewH
 take on the dimensions of _root.stage_mc[LargePic + ID].newPic.Image_mc
  before anything was loaded into it.
 (my resize button works off of the previewW and previewH vairables, this
 info is just FYI)
 var fitSizeW:Number = previewW;
 var fitSizeH:Number = previewH;
 var maxSizeW:Number = (previewW * 3);
 var maxSizeH:Number = (previewW * 3);
 var minSizeW:Number = (previewW / 3);
 var minSizeH:Number = (previewH / 3);

 Note: I have to keep previewW and previewH also because I have a
 mousescroll attached to that variable as well.

 I have a feeling that because the ImageLoader class loads a dummy MC for
 the bitmap
 and then removes it to place the img MC for smoothing, my script is not
 getting the final value
 of what is loaded into it and so previewW and previewH do not inherit its
 final values, just its beginning values.
 There is a background bitmap that gets replaced by the loaded image that is
 in the MC when it is placed on stage.
 This is the beginning value.

 This is in AS2 BTW.

 Any help would be GREATLY appreciated at this point.

 THX

 Karl DeSaulniers
 Design Drumm
 http://designdrumm.com

 ___
 Flashcoders mailing list
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Loading MC

2009-04-05 Thread Karl DeSaulniers
Hey thanks for your thoughts. Do you mean take the code out of the  
class and put it directly in my fla?


Karl

Sent from losPhone

On Apr 5, 2009, at 10:20 AM, Hans Wichman j.c.wich...@objectpainters.com 
 wrote:



Hi Karl,

your best bet is probably to checkout the imageloader source from  
martijn de
visser that you are using, and adapt that to be able to get at the  
values

you want.

Maybe this works:
target._width = target._width / 3;
target._height = target._height / 3;
_root.stage_mc[LargePic + ID].previewW = target._width;
_root.stage_mc[LargePic + ID].previewH = target._height;

regards,
JC

On Fri, Apr 3, 2009 at 12:03 PM, Karl DeSaulniers k...@designdrumm.com 
wrote:



Hello,
I was wondering if anyone can point me in the rigth direction.

I have been trying for days now to figure this out.
I know there is some little thing I am missing
and its probably right under my nose so to speak.

Here is my code:

//--
// Start Image loader
//--

import com.martijndevisser.ImageLoader;

_root.stage_mc.attachMovie(LargePic,LargePic +
ID,this.getNextHighestDepth());
_root.stage_mc[LargePic + ID].ID = ID;
_root.stage_mc[LargePic + ID]._x = originalX;
_root.stage_mc[LargePic + ID]._y = originalY;
var mcProgress:Number = 0;

var checkLoader:Object = new Object();
checkLoader.onLoadStart = function(target:MovieClip):Void  {
  trace(Start Width: + _root.stage_mc[LargePic +  
ID].previewW);
  trace(Start Height: + _root.stage_mc[LargePic +  
ID].previewH);
  _root.stage_mc[LargePic + ID].newPic.spiralLoader._visible  
= true;
  _root.stage_mc[LargePic +  
ID].newPic.spiralLoader.gotoAndPlay(2);

};
checkLoader.onLoadComplete = function(target:MovieClip) {
  target = _root.stage_mc[LargePic + ID].newPic.Image_mc;
  _root.stage_mc[LargePic + ID].newPic.percentCom.text = ;
  _root.stage_mc[LargePic + ID].newPic.spiralLoader.stop();
  _root.stage_mc[LargePic +  
ID].newPic.spiralLoader.gotoAndStop(1);

  _root.stage_mc[LargePic + ID].newPic.spiralLoader._visible =
false;
  target._width = target._width / 3;
  target._height = target._height / 3;
  _root.stage_mc[LargePic + ID].previewW =  
_root.stage_mc[LargePic

+ ID].newPic._width;
  _root.stage_mc[LargePic + ID].previewH =  
_root.stage_mc[LargePic

+ ID].newPic._height;
  trace(End Width: + _root.stage_mc[LargePic + ID].previewW);
  trace(End Height: + _root.stage_mc[LargePic +  
ID].previewH);

};
checkLoader.onLoadProgress = function(target:MovieClip,  
bytesLoaded:Number,

bytesTotal:Number):Void  {
  mcProgress = Math.ceil((bytesLoaded / bytesTotal) * 100);
  _root.stage_mc[LargePic + ID].newPic.percentCom.text =
mcProgress.toString() + %;
};
var loader:ImageLoader = new ImageLoader(_root.stage_mc[LargePic +
ID].newPic.Image_mc);
loader.addListener(checkLoader);
loader.loadImage(_global.projectPic,_root.stage_mc[LargePic +
ID].newPic.Image_mc);

//--
// End Image Loader
//--


To explain further, I have a oversized image loading at first which  
is

sized down 3 times.
Once it sizes down, I want previewW and previewH to equal the new  
width and

height.
Everything loads fine, it loads and the progress runs and it  
resizes fine,
but when I hit my resize button to make it smaller, the variables  
previewW

and previewH
take on the dimensions of _root.stage_mc[LargePic +  
ID].newPic.Image_mc

before anything was loaded into it.
(my resize button works off of the previewW and previewH vairables,  
this

info is just FYI)
var fitSizeW:Number = previewW;
var fitSizeH:Number = previewH;
var maxSizeW:Number = (previewW * 3);
var maxSizeH:Number = (previewW * 3);
var minSizeW:Number = (previewW / 3);
var minSizeH:Number = (previewH / 3);

Note: I have to keep previewW and previewH also because I have a
mousescroll attached to that variable as well.

I have a feeling that because the ImageLoader class loads a dummy  
MC for

the bitmap
and then removes it to place the img MC for smoothing, my script  
is not

getting the final value
of what is loaded into it and so previewW and previewH do not  
inherit its

final values, just its beginning values.
There is a background bitmap that gets replaced by the loaded image  
that is

in the MC when it is placed on stage.
This is the beginning value.

This is in AS2 BTW.

Any help would be GREATLY appreciated at this point.

THX

Karl DeSaulniers
Design Drumm
http://designdrumm.com

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

___

Re: [Flashcoders] Creating Dynamic addEventListeners with AS3

2009-04-05 Thread jonathan howe
Whatever the parent of the State_XX buttons are, you can refer to them as
named children of that parent.

So, if it's the current class use the this keyword:

this[State_ + rs[i]].addEventListener(etc...);

If it's another clip, etc, just refer to it by name:

someClipThatHasTheStateButtons[State_ + rs[i]].addEventListener(etc...);

Make sure you've named the instances via the IDE Instance name property or
have explicitly set the name property of the Buttons.


-jonathan





On Sun, Apr 5, 2009 at 8:33 PM, Graham Pearson gpear...@yourcfpro.comwrote:

 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1

 On my flash stage I have 50 buttons all named with the convention of
 State_IN, State_MI, State_WI, etc.

 At the present time I have 50 lines like the one line below of:

 State_IN.addEventListener(MouseEvent.CLICK, StateButtonClicked);


 What I am trying to do is when I retrieve the recordset back from the
 coldfusion component is to loop through the results like

 function GetClientsWithinCategory_Result(rs.Object) {
 for (var i:int = 0; i  rs.length; i++) {
  State_rs[i].addEventListener(MouseEvent.CLICK, StateButtonClicked);
  // The Value of rs[i] will return the 2 letter abriviation of the
 State eg: IN, WI, etc
 }
 }


 How do I go about combining State_ + the result from rs[i] so that
 when a user clicks on Indiana it will run the actionscript within the
 State Button Clicked Function



 -BEGIN PGP SIGNATURE-
 Version: GnuPG v1.4.8 (MingW32)
 Comment: GnuPT 2.6.2.1 by EQUIPMENTE.DE http://equipmente.de/
 Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

 iD8DBQFJ2U323GqPAgBSy90RAkayAJ95GlmD+MktDr++9Snhl5iSjk9fvACglA8m
 MwJ4iFh/Q6BivYcmxHfPyIw=
 =r37m
 -END PGP SIGNATURE-

 ___
 Flashcoders mailing list
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders




-- 
-jonathan howe
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Creating Dynamic addEventListeners with AS3

2009-04-05 Thread Rob Romanek

You can try something along the lines of

var stateButton = getChildByName(State_ + rs[i]);
stateButton.addEventListener(MouseEvent.CLICK, StateButtonClicked);

hth,

Rob

On 5-Apr-09, at 8:33 PM, Graham Pearson wrote:


What I am trying to do is when I retrieve the recordset back from the
coldfusion component is to loop through the results like

function GetClientsWithinCategory_Result(rs.Object) {
for (var i:int = 0; i  rs.length; i++) {
 State_rs[i].addEventListener(MouseEvent.CLICK, StateButtonClicked);
 // The Value of rs[i] will return the 2 letter abriviation of the
State eg: IN, WI, etc
}
}


How do I go about combining State_ + the result from rs[i] so that
when a user clicks on Indiana it will run the actionscript within the
State Button Clicked Function



___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Creating Dynamic addEventListeners with AS3

2009-04-05 Thread Hans Wichman
Might it be possible to only add a single listener to the parent for all
buttons?

On Mon, Apr 6, 2009 at 3:10 AM, Rob Romanek robli...@manibus.com wrote:

 You can try something along the lines of

 var stateButton = getChildByName(State_ + rs[i]);
 stateButton.addEventListener(MouseEvent.CLICK, StateButtonClicked);

 hth,

 Rob

 On 5-Apr-09, at 8:33 PM, Graham Pearson wrote:


 What I am trying to do is when I retrieve the recordset back from the
 coldfusion component is to loop through the results like

 function GetClientsWithinCategory_Result(rs.Object) {
 for (var i:int = 0; i  rs.length; i++) {
  State_rs[i].addEventListener(MouseEvent.CLICK, StateButtonClicked);
  // The Value of rs[i] will return the 2 letter abriviation of the
 State eg: IN, WI, etc
 }
 }


 How do I go about combining State_ + the result from rs[i] so that
 when a user clicks on Indiana it will run the actionscript within the
 State Button Clicked Function


  ___
 Flashcoders mailing list
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Loading MC

2009-04-05 Thread Hans Wichman
Hi,

erm no that's not what I said:).

Just read the original source file to deduct where it goes wrong, or try out
the replacement I suggested in your own code.

regards,
JC

On Mon, Apr 6, 2009 at 12:24 AM, Karl DeSaulniers k...@designdrumm.comwrote:

 Hey thanks for your thoughts. Do you mean take the code out of the class
 and put it directly in my fla?

 Karl

 Sent from losPhone


 On Apr 5, 2009, at 10:20 AM, Hans Wichman j.c.wich...@objectpainters.com
 wrote:

 Hi Karl,

 your best bet is probably to checkout the imageloader source from martijn
 de
 visser that you are using, and adapt that to be able to get at the values
 you want.

 Maybe this works:
 target._width = target._width / 3;
 target._height = target._height / 3;
 _root.stage_mc[LargePic + ID].previewW = target._width;
 _root.stage_mc[LargePic + ID].previewH = target._height;

 regards,
 JC

 On Fri, Apr 3, 2009 at 12:03 PM, Karl DeSaulniers k...@designdrumm.com
 wrote:

 Hello,
 I was wondering if anyone can point me in the rigth direction.

 I have been trying for days now to figure this out.
 I know there is some little thing I am missing
 and its probably right under my nose so to speak.

 Here is my code:

 //--
 // Start Image loader
 //--

 import com.martijndevisser.ImageLoader;

 _root.stage_mc.attachMovie(LargePic,LargePic +
 ID,this.getNextHighestDepth());
 _root.stage_mc[LargePic + ID].ID = ID;
 _root.stage_mc[LargePic + ID]._x = originalX;
 _root.stage_mc[LargePic + ID]._y = originalY;
 var mcProgress:Number = 0;

 var checkLoader:Object = new Object();
 checkLoader.onLoadStart = function(target:MovieClip):Void  {
  trace(Start Width: + _root.stage_mc[LargePic + ID].previewW);
  trace(Start Height: + _root.stage_mc[LargePic + ID].previewH);
  _root.stage_mc[LargePic + ID].newPic.spiralLoader._visible = true;
  _root.stage_mc[LargePic + ID].newPic.spiralLoader.gotoAndPlay(2);
 };
 checkLoader.onLoadComplete = function(target:MovieClip) {
  target = _root.stage_mc[LargePic + ID].newPic.Image_mc;
  _root.stage_mc[LargePic + ID].newPic.percentCom.text = ;
  _root.stage_mc[LargePic + ID].newPic.spiralLoader.stop();
  _root.stage_mc[LargePic + ID].newPic.spiralLoader.gotoAndStop(1);
  _root.stage_mc[LargePic + ID].newPic.spiralLoader._visible =
 false;
  target._width = target._width / 3;
  target._height = target._height / 3;
  _root.stage_mc[LargePic + ID].previewW = _root.stage_mc[LargePic
 + ID].newPic._width;
  _root.stage_mc[LargePic + ID].previewH = _root.stage_mc[LargePic
 + ID].newPic._height;
  trace(End Width: + _root.stage_mc[LargePic + ID].previewW);
  trace(End Height: + _root.stage_mc[LargePic + ID].previewH);
 };
 checkLoader.onLoadProgress = function(target:MovieClip,
 bytesLoaded:Number,
 bytesTotal:Number):Void  {
  mcProgress = Math.ceil((bytesLoaded / bytesTotal) * 100);
  _root.stage_mc[LargePic + ID].newPic.percentCom.text =
 mcProgress.toString() + %;
 };
 var loader:ImageLoader = new ImageLoader(_root.stage_mc[LargePic +
 ID].newPic.Image_mc);
 loader.addListener(checkLoader);
 loader.loadImage(_global.projectPic,_root.stage_mc[LargePic +
 ID].newPic.Image_mc);

 //--
 // End Image Loader
 //--


 To explain further, I have a oversized image loading at first which is
 sized down 3 times.
 Once it sizes down, I want previewW and previewH to equal the new width
 and
 height.
 Everything loads fine, it loads and the progress runs and it resizes
 fine,
 but when I hit my resize button to make it smaller, the variables
 previewW
 and previewH
 take on the dimensions of _root.stage_mc[LargePic + ID].newPic.Image_mc
 before anything was loaded into it.
 (my resize button works off of the previewW and previewH vairables, this
 info is just FYI)
 var fitSizeW:Number = previewW;
 var fitSizeH:Number = previewH;
 var maxSizeW:Number = (previewW * 3);
 var maxSizeH:Number = (previewW * 3);
 var minSizeW:Number = (previewW / 3);
 var minSizeH:Number = (previewH / 3);

 Note: I have to keep previewW and previewH also because I have a
 mousescroll attached to that variable as well.

 I have a feeling that because the ImageLoader class loads a dummy MC for
 the bitmap
 and then removes it to place the img MC for smoothing, my script is not
 getting the final value
 of what is loaded into it and so previewW and previewH do not inherit its
 final values, just its beginning values.
 There is a background bitmap that gets replaced by the loaded image that
 is
 in the MC when it is placed on stage.
 This is the beginning value.

 This is in AS2 BTW.

 Any help would be GREATLY appreciated at this point.

 THX

 Karl DeSaulniers
 Design Drumm
 http://designdrumm.com

 ___
 Flashcoders mailing list