RE: [Flashcoders] trouble with adding/removing multiple preloaders on thumbs

2009-09-19 Thread Keith Reinfeld
Thomas, 

I think the example code below addresses your primary concerns. The biggest
changes involve using a loaderArray to prevent overwriting previous Loader()
assignments, and also using getChildByName() to grab the relevant preloader
instance for removal. See inline comments. Let me know if you have any
questions. 
So, did you work out your image panning interaction? 

Code: 

import gs.TweenLite; 

var myXML:XML = pics 
IMAGE SMALL=images/pic1.jpg/ 
IMAGE SMALL=images/pic2.jpg/ 
IMAGE SMALL=images/pic3.jpg/ 
IMAGE SMALL=images/pic4.jpg/ 
IMAGE SMALL=images/pic5.jpg/ 
/pics; 
 
 
var container1:MovieClip = new MovieClip(); 
var loaderArray:Array = []; 
addChild(container1); 
var my_images:XMLList = myXML.IMAGE; 
var my_total:Number = my_images.length();  
 
callThumbs(); 
 
function callThumbs():void { 
for (var s:Number = 0; s  my_total; s++) { 
var thumb_url:String = my_images[...@small; 
// Store each Loader separately as an array element 
// so it won't be overwritten by the next. - KR 
loaderArray[s] = new Loader(); 
loaderArray[s].load(new URLRequest(thumb_url)); 

loaderArray[s].contentLoaderInfo.addEventListener(Event.COMPLETE,thumbLoaded
);  
var preloader:starPreloader = new starPreloader();  
// Name the preloader instance after the current url's 
// filename so we can pick-up on it later. - KR 
preloader.name =
thumb_url.substr(thumb_url.lastIndexOf(/)+1); 
loaderArray[s].y = 105 * s; 
// I am not putting the preloader 'in' the thumbnail, 
// just overlaying it. - KR 
preloader.y = 105 * s; 
//add preloader to the container 
container1.addChild(preloader); 
container1.buttonMode = true; 
// The next two lines caused reference errors for me - KR 
//zoom.small.addChild(container1); 
//container1.addEventListener(MouseEvent.CLICK, callFull); 
} 
} 
 
function thumbLoaded(e:Event):void { 
var my_thumb:Loader=Loader(e.target.loader); 
// Display the thumbnail image behind the preloader. - KR 
container1.addChildAt(my_thumb,0); 
// Here is where we identify the preloader that 
// corresponds with the current thumbnail image. - KR 
var currentURL:String = e.currentTarget.url; 
var preloaderName:String =
currentURL.substr(currentURL.lastIndexOf(/)+1); 
trace(\npreloaderName =,preloaderName); 
var preloader:starPreloader =
container1.getChildByName(preloaderName) as starPreloader; 
TweenLite.to(preloader, 1, {scaleX: 0, scaleY: 0, alpha: 0,
onComplete:thumbFinished, onCompleteParams:[container1, preloader]}); 
} 
 
function thumbFinished(mc:MovieClip, mc2:starPreloader):void { 
trace(\nthumbFinished() called,mc.name,mc2.name); 
//Remove the preloader 
mc.removeChild(mc2); 
} 


Regards,

Keith Reinfeld
Home Page: http://keithreinfeld.home.comcast.net



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


RE: [Flashcoders] trouble with adding/removing multiple preloaders on thumbs

2009-09-19 Thread thomas horner
Hi many thanks, will check this out in a sec, just having a full english
breakfast, yes managed to do the product zoomer with a lot of help from
'Cor' on here. it works really well, and i've made it kind of dynmaic so you
can select different angles to zoom, you are quite welcome to the fla is you
want,

thanks, Thomas

-Original Message-
From: flashcoders-boun...@chattyfig.figleaf.com
[mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Keith
Reinfeld
Sent: 19 September 2009 07:52
To: 'Flash Coders List'
Subject: RE: [Flashcoders] trouble with adding/removing multiple preloaders
on thumbs

Thomas, 

I think the example code below addresses your primary concerns. The biggest
changes involve using a loaderArray to prevent overwriting previous Loader()
assignments, and also using getChildByName() to grab the relevant preloader
instance for removal. See inline comments. Let me know if you have any
questions. 
So, did you work out your image panning interaction? 

Code: 

import gs.TweenLite; 

var myXML:XML = pics 
IMAGE SMALL=images/pic1.jpg/ 
IMAGE SMALL=images/pic2.jpg/ 
IMAGE SMALL=images/pic3.jpg/ 
IMAGE SMALL=images/pic4.jpg/ 
IMAGE SMALL=images/pic5.jpg/ 
/pics; 
 
 
var container1:MovieClip = new MovieClip(); 
var loaderArray:Array = []; 
addChild(container1); 
var my_images:XMLList = myXML.IMAGE; 
var my_total:Number = my_images.length();  
 
callThumbs(); 
 
function callThumbs():void { 
for (var s:Number = 0; s  my_total; s++) { 
var thumb_url:String = my_images[...@small; 
// Store each Loader separately as an array element 
// so it won't be overwritten by the next. - KR 
loaderArray[s] = new Loader(); 
loaderArray[s].load(new URLRequest(thumb_url)); 

loaderArray[s].contentLoaderInfo.addEventListener(Event.COMPLETE,thumbLoaded
);  
var preloader:starPreloader = new starPreloader();  
// Name the preloader instance after the current url's 
// filename so we can pick-up on it later. - KR 
preloader.name =
thumb_url.substr(thumb_url.lastIndexOf(/)+1); 
loaderArray[s].y = 105 * s; 
// I am not putting the preloader 'in' the thumbnail, 
// just overlaying it. - KR 
preloader.y = 105 * s; 
//add preloader to the container 
container1.addChild(preloader); 
container1.buttonMode = true; 
// The next two lines caused reference errors for me - KR 
//zoom.small.addChild(container1); 
//container1.addEventListener(MouseEvent.CLICK, callFull); 
} 
} 
 
function thumbLoaded(e:Event):void { 
var my_thumb:Loader=Loader(e.target.loader); 
// Display the thumbnail image behind the preloader. - KR 
container1.addChildAt(my_thumb,0); 
// Here is where we identify the preloader that 
// corresponds with the current thumbnail image. - KR 
var currentURL:String = e.currentTarget.url; 
var preloaderName:String =
currentURL.substr(currentURL.lastIndexOf(/)+1); 
trace(\npreloaderName =,preloaderName); 
var preloader:starPreloader =
container1.getChildByName(preloaderName) as starPreloader; 
TweenLite.to(preloader, 1, {scaleX: 0, scaleY: 0, alpha: 0,
onComplete:thumbFinished, onCompleteParams:[container1, preloader]}); 
} 
 
function thumbFinished(mc:MovieClip, mc2:starPreloader):void { 
trace(\nthumbFinished() called,mc.name,mc2.name); 
//Remove the preloader 
mc.removeChild(mc2); 
} 


Regards,

Keith Reinfeld
Home Page: http://keithreinfeld.home.comcast.net



___
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


[Flashcoders] localconnection in as2

2009-09-19 Thread Hans Wichman
Hi list,

as I understand it, there is a send/receive limit of 40k to the
localconnection object in actionscript2.
Mostly the objects passed in my application will probably be under 40k, but
the question is: how can you tell?

Is there some way to grab the actual AMF object flash is going to try and
pass and cut it up into pieces if necessary?
Or should you serialize and cut up everything beforehand just to be sure?

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


Re: [Flashcoders] localconnection in as2

2009-09-19 Thread Keith H
-If you don't want to worry about a send/receive limit on a String sent, 
take a look at this post here.
-If you just want to measure the size being sent,  you can look at the 
part where the poster is dividing the length of the String sent by the 
limit.


http://www.ultrashock.com/forums/actionscript/40k-byte-size-limit-on-localconnection-56395.html

...hope that leads you in the way you want to go.


-- Keith H --
www.keith-hair.net





Hans Wichman wrote:

Hi list,

as I understand it, there is a send/receive limit of 40k to the
localconnection object in actionscript2.
Mostly the objects passed in my application will probably be under 40k, but
the question is: how can you tell?

Is there some way to grab the actual AMF object flash is going to try and
pass and cut it up into pieces if necessary?
Or should you serialize and cut up everything beforehand just to be sure?

regards,
Hans
___
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