Jump to content
Search Community

ShortBus

Members
  • Posts

    41
  • Joined

  • Last visited

Everything posted by ShortBus

  1. Hi All & good day- Another newb question here I need "thumb" to be an object instead of a string. I've xml nodes that consist of I can access "thumb" through vars but it comes up a string assets/thumbnails/movie1.swf assets/thumbnails/movie2.swf assets/thumbnails/movie3.swf assets/thumbnails/movie4.swf This is how I'm approaching it var xmlLoader:XMLLoader = new XMLLoader("assets/data.xml", {name:"assetList", onProgess:progressHandler, onComplete:xmlCompleteHandler}); xmlLoader.load(); function xmlCompleteHandler(event:LoaderEvent):void{ trace("XML loaded!"); var mainQueue = LoaderMax.getLoader("loaderQueue"); trace("What's in the mainQueue= " + mainQueue.content); var swfArray = mainQueue.content; trace("swfArray contains= " + swfArray); for (var m:int = 0; m < swfArray.length; m++){ mainHolder.addChild(swfArray[1]); swfArray[1].scaleX = swfArray[1].scaleY = 0.25; TweenLite.to(swfArray[1], 1, {alpha:1}); } var thumbArray = mainQueue.getChildren(); for (var t:int = 0; t < thumbArray.length; t++){ if (thumbArray[t] is SWFLoader){ var thumb:ContentDisplay = thumbArray[t].content; } var thumbURLS = thumbArray[t].vars.thumb; trace(thumbURLS); } mainQueue.load(); trace("children of XMLLoader " + event.target.getChildren().length); } Am I missing something that LoaderMax would do natively of do I need to come up with some kind of "stringArrayToObjectArray" and append it to my swfArray? Thanks in advance as always Karl
  2. Hi Chris- Have you setup handlers to check that everything is loading properly? Kind of sounds like there's a partial load happening initially?
  3. The link is a 404 now. Carl turned me onto this complete handler trace with is good start to troubleshooting. trace("Children of the loader" + event.target.getChildren()); Should be able to see if the audio file is getting loaded...
  4. I guess, more to the point, I'm asking if there's a way to reference the "THUMB" var in the queue that's already created. "url" was easy because it's native(?) and the nodes are setup as ContentDisplay objects. I can't really use SWFLoader.@THUMB for a reference and I've tried to restructure the xml this but it got cranky : Would I need to manually parse the XML & define the "THUMB" url as ContentDisplay objects in a separate function & loader? I'm just digging to see how much loader info can be stashed in XML and used correctly in a gallery/slideshow scenario. Just a learning newb Thanks K
  5. Hi Carl- I am using Jack's slideshow demo as reference for my project but setting up xml differently (as noted) and combining it in the fla. That's where I got stumped. Between the 2 classes of the demo I couldn't figure out how to target the thumbs for clicking & displaying the associated image. I'm jumping back into it this morning, armed with your troubleshooting info you provided & see if I get smarter Thanks K
  6. Wondering if this would be better in XML forum? Please advise...
  7. Hi All- If I'm setting up, say an XML slideshow using XML data like: <?xml version="1.0" encoding="iso-8859-1"?> And AS3/GS code: import com.greensock.events.LoaderEvent; import com.greensock.loading.display.ContentDisplay; import com.greensock.loading.SWFLoader; import com.greensock.loading.LoaderMax; import com.greensock.loading.XMLLoader; import com.greensock.TweenLite; import flash.display.MovieClip; import flash.display.Sprite; import flash.events.MouseEvent; LoaderMax.activate([sWFLoader]); var mainHolder:MovieClip; var xmlQueue:LoaderMax; var xmlArray:Array; var xmlTotal:Number; var xmlContent:String; btn1.addEventListener(MouseEvent.CLICK, goToMov1); btn2.addEventListener(MouseEvent.CLICK, goToMov2); btn3.addEventListener(MouseEvent.CLICK, goToMov3); btn4.addEventListener(MouseEvent.CLICK, goToMov4); // Preloader stuff var txtProgress:TextField = new TextField(); txtProgress.autoSize = TextFieldAutoSize.CENTER; txtProgress.x = 187.5; txtProgress.y = 190; txtProgress.selectable = false; var txtProgressFormat:TextFormat = new TextFormat(); txtProgressFormat.color = 0x888888; txtProgressFormat.size = 18; plWheel.visible = false; function progressHandler(event:LoaderEvent):void { plWheel.visible = true; addChild(txtProgress); var perc:Number = xmlLoader.progress; txtProgress.text = Math.ceil(perc*100).toString() + "%"; txtProgress.setTextFormat(txtProgressFormat); } var xmlLoader:XMLLoader=new XMLLoader("assets/data.xml",{name:"assetList", estimatedBytes:15000000, onComplete:xmlHandler, onProgress:progressHandler}); xmlLoader.load(); function xmlHandler(event:LoaderEvent):void { trace("XML Loaded!"); //Hide the preloader components txtProgress.visible = false; plWheel.visible = false; //Process the XML var xmlQueue = LoaderMax.getLoader("xmlQueue"); var xmlArray = xmlQueue.content; for (var i:int = 0; i < xmlArray.length; i++) { mainHolder.addChild(xmlArray[0]); xmlArray[0].scaleX = xmlArray[0].scaleY = 0.25; TweenLite.to(xmlArray[0], 1, {alpha:1}); } xmlTotal = xmlArray.length; xmlContent = event.target.content; //setupThumbs(); trace(xmlArray.length + " items stored in xmlArray"); trace(event.target); trace("Number of children in thumbHolder now is " + thumbHolder.numChildren); trace("Number of children in mainHolder now is " + mainHolder.numChildren); } How do I identify "XMLList" nodes to associate thumbs with display? I almost want to say images but I'm using SWF files for thumbs and images (lighter project). I can't even figureout how to trace & get the node values, just the entire xml contents. Feeling quite lost of is it better in this scenario to call teh loaders from script? Thanks Karl
  8. Hi Dave- I hit that url and nothing seems to fire. Have you traced your loader to confirm that things are actually loading?
  9. Just curious, has anyone had experience with multi-scale image and LoaderMax? I just downloaded the OpenZoom SDK but haven't jumped in yet. BTW: Jack, loving the GS classes! Been having a ton of fun with XMLLoader especially, what a work saver! Karl
  10. Thanks for the props Carl I'm always figuring I'm doing less than... The project I'm reworking is this http://www.nufriday.com/productDisplay6/productDisplay6.html and although it works, the loading bugs me. That's why I turned to LoaderMax. I think I can do the magnification slicker but that may be a pipe dream. That one has layers of sprites & the mask revealing the "large image based on coords... I worked on that little thing for a month but it was a good "russian baby swimming lesson" I'm gonna take your suggestion & run as far as I can with it, I do appreciate your time, really From the back of the ShortBus... Karl
  11. Hi Carl, thanks for the response. I'm sure I don't make much sense, please bear with lingo ignorance. I'm looking to load all big images to reduce wait time between views. I'd like to get average load time for the project to about 4-6 seconds via typical DSL & have minimal delay between views. I'm running a class (1st time doing that), working in FlashDevelop (1st there too, dig it) & CS4. Currently have this as my current code: package { import com.greensock.events.LoaderEvent; import com.greensock.loading.data.ImageLoaderVars; import com.greensock.loading.data.SWFLoaderVars; import com.greensock.loading.display.ContentDisplay; import com.greensock.loading.ImageLoader; import com.greensock.loading.LoaderMax; import com.greensock.loading.SWFLoader; import com.greensock.loading.XMLLoader; import com.greensock.TweenMax; import flash.display.MovieClip; import flash.display.Sprite; import flash.events.MouseEvent; import flash.text.TextField; /** * ... * @author Karl Engstrom and tutorials from snorkl & zync */ public class pD7main extends Sprite { private var xImgList:XMLList; public var thumbHolder:MovieClip; public var mainHolder:MovieClip; public var circularPreLoader:MovieClip; public function pD7main() { //Load up the XML var xmlLoader:XMLLoader = new XMLLoader("xml/prodImages.xml", { name:"xmlLoader", maxConnections:4} ); xmlLoader.addEventListener(LoaderEvent.COMPLETE, loadFirst); xmlLoader.addEventListener(LoaderEvent.COMPLETE, xmlLoaded); xmlLoader.load(); circularPreLoader.alpha = 0; } private function progressHandler(event:LoaderEvent):void { circularPreLoader.alpha = 1; circularPreLoader.scaleX = event.target.progress; } private function xmlLoaded(e:LoaderEvent):void { var xData:XML = e.target.content; xImgList = new XMLList(xData.img); //Setup a LoaderMax object var thumbLoader:LoaderMax = new LoaderMax( { name:"thumbLoader", onComplete:thumbsLoaded } ); //Setup variables for our ImageLoaderVars var nImgWidth:Number = 80; var nImgHeight:Number = 80; var nMaxCols:Number = 4; var colSpace:Number = 5; for (var i:int = 0; i < xImgList.length(); i++) { var iLoad:SWFLoader = new SWFLoader("thumbs/"+xImgList[i].@url, new SWFLoaderVars() .name(xImgList[i].@name) .width(nImgWidth) .height(nImgHeight) .container(thumbHolder) .x((i % nMaxCols) * (nImgWidth + colSpace)) .prop("index", i) .prop("url", xImgList[i].@url) .alpha(0) ) thumbLoader.append(iLoad); } thumbLoader.load(); trace("evertything loaded"); trace("children of XMLLoader " + e.target.getChildren()); trace("number of children of XMLLoader " + e.target.getChildren().length); } private function thumbsLoaded(e:LoaderEvent):void { //Setup click events for thumbs for (var i:int = 0; i < xImgList.length(); i++) { var cdImg:ContentDisplay = LoaderMax.getContent("p" + (i + 1)); cdImg.buttonMode = true; cdImg.addEventListener(MouseEvent.CLICK, thumbClick); TweenMax.to(cdImg, 0.5, { autoAlpha:1, delay: (i * 0.2) } ); } } private function thumbClick(e:MouseEvent):void { var vars:Object = SWFLoader(e.currentTarget.loader).vars; checkOldImage(vars.index) } private function checkOldImage(index:Number):void { //Check if theres already an image loaded if (mainHolder.numChildren > 1) { var oldClip:Sprite = Sprite(mainHolder.getChildAt(0)); TweenMax.to(oldClip, 0.1, {alpha:0.5, onComplete:function() { mainHolder.removeChildAt(0); loadImage(index)} }) } else { loadImage(index); } } private function loadFirst(e:LoaderEvent):void { //Setup the first image to display in mainHolder var firstImgLoader:SWFLoader = new SWFLoader("images/image1.swf", new SWFLoaderVars() .scaleX(.25) .scaleY(.25) .scaleMode("proportionalInside") .container(mainHolder) .alpha(0) .onProgress(progressHandler) .onComplete(firstImgLoaded) ) //Add first image to mainHolder firstImgLoader.load(); } private function loadImage(index:Number):void { //Get filename var file:String = xImgList[index].@url; //Setup the main image loader var mainLoad:SWFLoader = new SWFLoader("images/" + file, new SWFLoaderVars() .scaleX(.25) .scaleY(.25) .scaleMode("proportionalInside") .container(mainHolder) .alpha(0) .onComplete(imageLoaded) ) //Add clicked thumb image to mainHolder mainLoad.load(); } private function firstImgLoaded(e:LoaderEvent):void { progressBarMC.visible = false; var firstImgClip:ContentDisplay = LoaderMax.getContent(e.currentTarget.name); TweenMax.to(firstImgClip, 0.75, { alpha:1 } ); } private function imageLoaded(e:LoaderEvent):void { var imgClip:ContentDisplay = LoaderMax.getContent(e.currentTarget.name); TweenMax.to(imgClip, 0.75, { alpha:1 } ); } } } I haven't sat down to rethink what I'm doing with this project. Am I making it more complicated that it needs to be? I feel I probably am as I'm basing much on Zync's tutorial & fudging where I need to... Any help would be greatly appreciated but not to lean on y'all too much, I'd dying to learn! Thanx Karl
  12. I'm building an app based on tuts & hints from GS, snorkl, zync & others and ran into a bit of a snag. I've got 4 swfs ranging from 118-249K and I'd like to load them all before the preloader ends. Having 2 loader instances (one static for initial image, one dynamic for thumb clicks), I can only figure out how to fire the progress handler from the static loader. The static loader function isn't directly an "event" per se, the event is upstream as a mouse click. Is there any way to push them all into browser cache to start with or am I just a lost newb in a sea of code Any thoughts welcomed Karl
  13. You know it Hickory with a pear finish tonight... this 12 pounder should last a couple days, hopefully Cheerz King Coder dood, thx for the help
  14. Too funny Carl, though I see from snorkl you like to keep things light, good for you. Life in general can get heavy I did grab Jack's gallery example, was kinda daunting but after my 1st class based tut today (Zync) I see the method & advantages of classes (break the monster into pieces & attack one at a time). One thing about GS I don't like (as a newb) is that I miss understanding the core essentials of ECMA scripting while working in it. Therefor I have been working 2 or more things at once to absorb what I can. As a time saver it's awesome and as well I just (today) installed Flashdevelop which is a shortcut heaven Thanks for all you & Jack (e.g.: GS crew?) do and I'm looking forward to learning and producing more in the near future. Gotta go, smoking a 12lb brisket in the rain Karl (riding the short bus licking the window )
  15. Hi Carl, thank for the reply. I don't know if you are part of the development team at GS but kudos to you & all you do in this forum. I enjoy your snorkl site & have it bookmarked for constant reference. The traces you supplied did confirm 4 children, thx evertything loaded children of XMLLoader SWFLoader 'image1' (images/image1.swf),SWFLoader 'image2' (images/image2.swf),SWFLoader 'image3' (images/image3.swf),SWFLoader 'image4' (images/image4.swf) number of children of XMLLoader 4 I forgot to mention in the prior post that I was spending some time at snorkl.tv & I was working off your tuts on LoaderMax & XMLLoader. You probably don't need to see your code agan. I just stacked the images in one of my changes. It took me a while to figure out how to load SWF from your examples, then I picked it up on LoaderMax tip&tricks. I used the XML to call SWFLoader, which I think is a pretty dang spiffy option <?xml version="1.0" encoding="iso-8859-1"?> I did change up the queueCompleteHandler to pull "image1" to the front, but I see now it "referred to?". That's where I was thinking another child was added (quite newb, remember) function queueCompleteHandler(event:LoaderEvent):void{ progressBar_mc.visible = false; progressBar_txt.visible = false; var queueLoaded = LoaderMax.getContent("image1"); spBoard.addChild(queueLoaded); TweenLite.to(queueLoaded, 2, {alpha:1}); } This project I'm working on seemed kind of simple at the onset but I'm seeing it's got weight. Essentially I'm looking to get is an app that effectively works like a simple S c e n e 7 product display with view choices & zooming/magnification. The big issue has always mostly been the zoom aspect (I spent a month [on & off] on the version that works now, LOL) It's all good and I'm learning all the time. Again, thanks for the help, I'm working on doing an array & thumb calls now. Karl
  16. Hello folks- First off I want to congratulate y'all on the great Greensock project! I'm new to ECMA scripting and learning on a daily basis. I wrote a small app in native AS3 that works like a tiny XML gallery with thumbnails & magnifying glass for a friends website. It only will have 2-4 images when in production as it's a product display app. The images that load are 1500x1500 so I've been working with SWFs for reduced file size. My original works alright but I needed something to bulk load, thus finding LoaderMax. I also ended up with 5 separate loaders, probably because I'm such a newb. I'm looking for the best ways to troubleshoot so I don't do so much trial & error (which there's plenty of already, LOL). For instance, in my test app I'm using XMLLoader & calling SWFLoader in the XML file to load 4 SWFs. On the queue complete my function adds a child "image1" using the getContent method as "image4" ends up being the top most image (child?). Am I thinking about this the wrong way or shouldn't there be 5 objects (children?) now? My trace trying to find numChildren shows 1 object Sprite. My traces of onChildComplete show the 4 images. My numChildren trace looks like this right now. for (var i:uint = 0; i < this.numChildren; i++){trace ('\t|\t ' +i+'.\t name:' + this.getChildAt(i).name + '\t type:' + typeof (this.getChildAt(i))+ '\t' + this.getChildAt(i));} And the output is | 0. name:progressBar_mc type:object [object MovieClip] | 1. name:progressBar_txt type:object [object TextField] | 2. name:instance2 type:object [object Sprite] I have many, many questions but this should break the ice & help me along my way. Anything that'll help a poor old newb would be greatly appreciated Thanks, Karl
×
×
  • Create New...