Jump to content
Search Community

ShortBus

Members
  • Posts

    41
  • Joined

  • Last visited

Everything posted by ShortBus

  1. I'd have to guess that you have SWFLoader declared somewhere in your AS code. I think that if you only reference the loader type in your XML that you have to activate it in the AS code to fire the particular loader class. I could be wrong, I'm getting things backwards all the time
  2. Thanks for the tip Carl, it was so obvious once you showed me! Now when I trace in that thumbClick function trace("The current target is= " + event.currentTarget.name); I get The current target is= loader1 The current target is= loader2 The current target is= loader3 The current target is= loader4 or without .name is The current target is= [object ContentDisplay] The current target is= [object ContentDisplay] The current target is= [object ContentDisplay] The current target is= [object ContentDisplay] Now I need to research how to swap the object CDs around per corrosponding thumbnail. Thanks again, you're a great help Karl
  3. Thanks for the response Carl, yeah, I was jamming everything in the mainLoader. Jack had suggested loading it all at once and manipulating after. I know I missed something in the translation to my uneducated eye. LoaderMax creates it's own "array" of sorts doesn't it? And called through the content method? I'll try your suggestion when I get in from outdoor work. Thanks much K
  4. Hi All- If I have an array containing thumbnail and fill size assets, but when targeting either I'm getting null reference errors. I'm loading my assets & putting them into an array in the order I want in my xmlCompleteHandler and cleaning up preloader children and tweening in my displays in the mainCompleteHandler. Up through that point it's doing exactly what I want. Much of how to get to this point was answered in this thread http://forums.greensock.com/viewtopic.php?f=6&t=6240 Now I'm at a loss as to how to properly access the thumb swfs to make them clickable and target the corrosponding main swfs in the node. I'd like to use the swapChildren method but I haven't been able to successfully get to properly triggering from the thumbs... I've used for (var i:int = 0; i < pntLoaders.length-4; i++) in my setupListeners function which will get rid of the null errors but in the end result of this project the nodes may range from 2 to 6 depending on the product. I've read many threads & tutorials but haven't found anything yet that helps me in this situation. The XML: <?xml version="1.0" encoding="iso-8859-1"?> The AS: import com.greensock.events.LoaderEvent; import com.greensock.loading.display.ContentDisplay; import com.greensock.loading.LoaderMax; import com.greensock.loading.data.LoaderMaxVars; import com.greensock.loading.SWFLoader; import com.greensock.loading.data.SWFLoaderVars; import com.greensock.loading.XMLLoader; import com.greensock.TweenMax; import flash.display.MovieClip; import flash.events.MouseEvent; import flash.text.TextField; var mainHolder:MovieClip; var xml:XML; var xmlList:XMLList; var pntLoaders:Array = []; //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 = true; function progressHandler(event:LoaderEvent):void { plWheel.visible = true; txtProgress.visible = true; this.addChild(plWheel); this.addChild(txtProgress); var perc:Number = event.target.progress; txtProgress.text = Math.floor(perc*100).toString() + "%"; txtProgress.setTextFormat(txtProgressFormat); } //End preloader stuff var xmlLoader:XMLLoader = new XMLLoader("assets/data.xml", {name:"assetList", onComplete:xmlCompleteHandler}); xmlLoader.load(); function xmlCompleteHandler(event:LoaderEvent):void{ trace("XML loaded"); var xml = xmlLoader.content; var xmlList = new XMLList(xml.swf); //Setup the mainLoader with all swfs var mainLoader = new LoaderMax(new LoaderMaxVars() .maxConnections(4) .onProgress(progressHandler) .onComplete(mainCompleteHandler) ); for (var p:int = 0; p < xmlList.length(); p++){ //Setup the large swfs into mainLoader var productLoader:SWFLoader = new SWFLoader("assets/products/" + xmlList[p].@url, new SWFLoaderVars() .name(xmlList[p].@name) .x(0) .y(0) .scaleX(.25) .scaleY(.25) ); mainLoader.append(productLoader); } for (var t:int = 0; t < xmlList.length(); t++){ //Setup the thumbnail swfs into mainLoader var tWidth = 80; var tSpace = 18; var tCols = 4; var thumbnailLoader:SWFLoader = new SWFLoader("assets/thumbnails/" + xmlList[t].@url, new SWFLoaderVars() .name(xmlList[t].@thumbName) .x((t % tCols) * (tWidth + tSpace)) .y(415) ); mainLoader.append(thumbnailLoader); } mainLoader.load(); //Build an array of product and thumbnail swfs in the proper order pntLoaders = mainLoader.getChildren(); var i = pntLoaders.length; while (--i > -1) { mainHolder.addChild(pntLoaders[i].content); } TweenMax.to(mainHolder, 0, {alpha:0}); } function mainCompleteHandler(event:LoaderEvent):void{ trace("mainLoader loaded, mainCompleteHandler triggered"); //Tween out the preloader stuff & remove the children TweenMax.to(plWheel, 0.5, {alpha:0}); TweenMax.to(txtProgress, 0.5, {alpha:0}); this.removeChild(plWheel); this.removeChild(txtProgress); trace("The number of children in the mainHolder is " + mainHolder.numChildren); TweenMax.to(mainHolder, 1, {alpha:1}); setupListeners(); } function setupListeners(){ for (var i:int = 0; i < pntLoaders.length; i++){ var thumbArr = LoaderMax.getContent("assets/thumbnails/product" + (i + 1) + ".swf"); var thumbButton:ContentDisplay = thumbArr; thumbButton.addEventListener(MouseEvent.CLICK, thumbClick); thumbButton.buttonMode = true; } } function thumbClick(event:MouseEvent):void{ trace("The thumbnail was clicked"); trace("The current target is= " + event.target.loader); trace("The mainHolder how has " + mainHolder.numChildren + " children"); // } Have I painted myself into a corner again? Any ideas appreciated! Thanks Karl
  5. Hi Rob- I think you can use the scaleMode method in the SWFLoaderVars for that. Like: new SWFLoaderVars() .scaleMode("proportionalInside") or in your case scaleMode="proportionalInside" in your xml. If that's going to skew your SWF you can probably use crop="true" too... HTH Karl
  6. Makes sense Jack, I'm going to work with your examples tomorrow. I'm also re-watching Rich's videos, I seem to learn more every time I watch them. All this AS stuff is making a little more sense all the time. Thanks Karl
  7. First, thanks for all the advice I've gotten here, y'all are great! I had to take some time off from this project to work on other things, thus the delay. I've got everything loading at once now and have an array which is all looking great. I've just one movieclip and all the objects are located during the load making things simple there. Now I'm uncertain how to address manipulating specific items with the array. I've searched all over but nothing seems to address my specific circumstance. If I setup a for statement in my complete handler to trace what I've got in the array for (var i:int = 0; i < pntLoaders.length; i++){ var pntLoadersContent:String = pntLoaders[i].valueOf(); trace("The pntLoaders array content is= " + pntLoadersContent); } I see (with the .name var commented out in my loaders) The pntLoaders array content is= SWFLoader 'loader1' (assets/products/product1.swf) The pntLoaders array content is= SWFLoader 'loader2' (assets/products/product2.swf) The pntLoaders array content is= SWFLoader 'loader3' (assets/products/product3.swf) The pntLoaders array content is= SWFLoader 'loader4' (assets/products/product4.swf) The pntLoaders array content is= SWFLoader 'loader5' (assets/thumbnails/th_product1.swf) The pntLoaders array content is= SWFLoader 'loader6' (assets/thumbnails/th_product2.swf) The pntLoaders array content is= SWFLoader 'loader7' (assets/thumbnails/th_product3.swf) The pntLoaders array content is= SWFLoader 'loader8' (assets/thumbnails/th_product4.swf) I'm at a loss as to access either the loader# or the url so I can assign mouse events & such. I was looking for something like matching "assets/thumbnails/th_product" + (i + 1) + ".swf" after parsing the array but I was getting no where... Maybe taking a break from the project wasn't good for my brain... Any help is appreciated Thanks K
  8. Have you tried setting maxConnections:1 to see if it steps through nicer? Also, check your xml for any errant typos or anything in that last node. What does your xml look like? Can't think of anything more with what you've provided so far... Karl
  9. NP, I think I may be learning a little also while trying to help K
  10. I finally got 5.5 installed here, no errors. Here's what I saw preloader_cs5.fla Output 0.8 0.9899994375386693 hello menu nothing to remove home subMenu 1 loaded Medallion_cs5.fla Fonts missing HelveticaNeue-Medium HelveticaNeue-UltraLigCond Output hello menu nothing to remove home subMenu No errors here either. Is there something on your local box that may be whacky? Karl
  11. You can just zip or rar up the fla & assets then use the Upload attachment of the post, next to Options. Like Carl said, your XMLLoader may be causing you grief. Have you tried running it outside your Preloader function? I've only seen XMLLoader running first, then followed by an xml complete handler. That way you can trace it in the beginning of the complete handler & see if it really did what it was supposed to do. I'm quite a newb so I have seen variations like a lot of these guys... I also see onProgress:progressHandler in both the LoaderMax and SWFLoader's. Maybe that's crimping your style? Dunno. Also, if you wanted you could make use of the progress LM has built in, like var perc:Number = event.target.progress; //Saves some math headache progressBar.prog_txt.text = Math.floor(perc*100).toString() + "%"; See if you can get your stuff uploaded, I'm sure someone here can help Karl
  12. Hi ice- Hard to tell exactly without seeing what part of you code is throwing that error. I like to put traces everywhere I can because I'm a noob. That being said, I'd have to guess that whatever property you are asking for isn't fully loaded at time of asking. Maybe use a different listener like onChildComplete? Dunno... But I had just googled (with quotes) "Error #2099: The loading object is not sufficiently loaded to provide this information" and got 5,280 hits, maybe there's something out there to give a hint?.
  13. Hi Ben, thought I'd chime in here if I could. The error looks pretty strait forward "Loading error on ImageLoader 'reload' (1/images/reload_1.png): Error #2035: URL Not Found". Based on "E|/Adobe%20developer/Flash%20Tutorials/Stacey%20Reiman/Test/Chaohoi%5FV0001/1/images/reload_1.png" I'm guessing your fla is in "E|/Adobe developer/Flash Tutorials/Stacey Reiman/Test/Chaohoi_V0001/" ? If not, maybe that's the issue. I've run into messes like that in the past, I've found that keeping my project directory paths as simple as possible really helps narrowing down like problems, (e.g.: "C:\FlashProjects\loaderMaxTest4\"). Long paths with spaces can make it confusing. HTH A different Karl
  14. Hi Jack, thanks for the patients & insight. I had read in posts & the ASDocs about ContentDisplay objects but I guess it wasn't really sinking in that they Are actually Sprites. I guess with my limited (but growing) knowledge of tracing and troubleshooting, if I didn't see the words "object Sprite" returned I assumed it was something else. I guess with so many years in hardware & networking I have some blinders on regarding coding Thanks for the loop suggestion, I'll be putting that to use today over coffee & Mt Dew sessions. I've had the maxConnections set from 1 to 4 throughout testing, not long before canning that sample it was 2. There again, I've been tweaking things every which way to see what happens during my learning & development. Making better use of the bandwidth is definitely something I can get behind and the main reason I got so interested in GS in the first place. I'm certainly glad that the buddy that I'm doing the site for has patients. I told him we could set him up like the big manufacturers so he could increase his sales, then found out how they do it wasn't cheap & easy, LOL. But then again I'm doing it pro bono so I'm learning on my dime. The separation thing has been bugging be. I figured I needed to create an array of sorts to reference but haven't gotten that far. I'm curious about implementing listeners. When I've been building "Lego style" like I have I sometimes feel I need multiple "onComplete" listeners to point to different functions. Is this just my lack of consolidation (e.g.: experience) or are their times this is viable? Thanks again for the in depth response and I'll be digging in hard today. Kind regards Karl
  15. In trying to work with what I've shown ya I think I came to the conclusion I should maybe switch to basing my project on sprites and see about loaded each object into it's own sprite. Seems like I'll have more control that way and I'm going to probably be needing to setup some sprite layers for masking in the magnify segment of the project. If anyone thinks of an idea for what I already have, please let me know. Thanks Karl
  16. I got ahead of myself... you are exactly right, it's an invisible object. That's where I was heading in the first place, I was looking to swap children so I'm not having this issue. I can't trim it down much more than this to show the issue, but overall it's not terribly long. The alpha property at line 38 is what I'd like to avoid The mouse event handlers just drag for simplicity
  17. Hi Jack, thanks for all the GS goodies The "loader0" was just a reference as I am assuming my SWFLoader w/ loop is putting it all in one place. I'm trimming the fat for something to post, I'm sure y'all don't need 160+ lines. I pretty new to ECMAScript so it gets ugly... Post the fla shortly K
  18. Hi Carl, good chatting with you again I am just using a container and all 4 swfs are dumping into it. I intent on loading all images(there will never be more than 4-6) for this project to have instant viewing from thumb clicks. Here's my xmlCompleteHandler: var xmlLoader:XMLLoader = new XMLLoader("assets/data.xml", {name:"assetList", onComplete:xmlCompleteHandler}); xmlLoader.load(); function xmlCompleteHandler(event:LoaderEvent):void{ trace("XML loaded!"); var xml = xmlLoader.content; var xmlList = new XMLList(xml.mov); trace("The xmlList= " + xml); var mainLoader = new LoaderMax({name:"mainLoader", maxConnections:1, onProgress:progressHandler, onComplete:mainCompleteHandler}); for (var i:int = 0; i < xmlList.length(); i++){ var movLoader:SWFLoader = new SWFLoader("assets/products/" + xmlList[i].@url, new SWFLoaderVars() .name(xmlList[i].@name) .container(mainHolder) .scaleX(.25) .scaleY(.25) //.alpha(0) ) mainLoader.append(movLoader); }; mainLoader.load(); } There is another similar for loading thumbs... You'll notice I had an alpha property in there and until now I was changing alpha to 1 in a following handler with TweenMax.to(mainHolder.getChildAt(0), .75, {alpha:1}); That all worked fine until I moved to the "click to magnify" part of the project and product1(child 0), even though showing, wasn't the event target. See where I'm going with this? Does the way I'm doing it mean loader0 has all display objects and that's why I'm have a hard time with it? Thanks again Karl
  19. Hello all- I've a situation where I'm loading 4 swfs into a movie clip. They load in as product1 product2 product3 product4 Where product 4 is topmost & visible. I'm trying to swap or set child indexes so product1 is topmost at initial load and I'm failing miserably. The following don't work, product4 always comes to the top. var product1 = mainHolder.getChildAt(0); var product4 = mainHolder.getChildAt(3); mainHolder.swapChildren(product1,product4); mainHolder.swapChildrenAt(0,numChildren -1); var product1 = mainHolder.getChildAt(0); mainHolder.setChildIndex(product1,mainHolder.numChildren -1); Any thoughts on the matter are appreciated Thanks Karl
  20. Looks like a typo (thhumbholder) but it looks right in your code chunk trace(thumbholder); instead of trace("trace1"); before your 1st function, if it exists it should return [object MovieClip] If it doesn't show you that, check your stage. Maybe got ya it switched around and needs to be thumbholder_mc instead? I'm not sure about the XMLLoader activation being inside the function or that you need it, I haven't yet... I've only needed to activate loaders that aren't called in the script but in the XML and that's only been for SWFLoader, ImageLoader, etc... and I'll generally put those up under the imports. Another neat thing about LoaderMax is the garbage collection. You don't have to remove event listeners if you use something like this in your BethPage function public function BethPage() { super(); alpha = 0; LoaderMax.activate([xmlLoader]); //Needed?? var xPhoto:XMLLoader = new XMLLoader("image.xml", {onChildComplete:xmlLoaded}); xPhoto.load(); trace("trace2"); //Will only say trace2, nothing meaningful } Because you are never seeing "trace3" it's telling me that your xmlLoaded isn't firing. Something I've been learning is to start my functions with a trace like trace("xmlLoader just got triggered"); for whatever the function name is. that way I know I at least got to that point. Then moving line by line, tracing events, targets & contents, etc... I'm new to it too so that's been helping me quite a bit. HTH Karl
  21. Thanks Carl. My mind has been spread thin over server management, client fubars and adding a boat shed to the property. I hope to get into the groove properly soon and be able to react to your wisdom. K
  22. No matter what I do I keep ending up with coercion errors. See, I have 2 url's in the same node, one is 'url=' the other is 'thumb=' and vars just grabs the string as far as I can tell. I think restructuring my thinking from the xml out is my best plan... Fun learning what I can & can't do though Thanks again Carl Karl
  23. Thanks much Carl, gonna roll through this in the morning. You're a great help! K
  24. Thanks for your detailed answer Carl. I'm playing with different methods while learning and it seems I get into a corner & unable to express the correct terms. When I trace mainQueue.content.length I get 4 as it's seeing "url" in the node and grabbing that as contentDisplayObject. Where I am getting lost is how to get the "thumb" displayed & usable for mouse events. If I use mainQueue.getChildren() I get coercion errors. I'm also not sure if I can add event listeners within this line. Haven't found that in the AS docs. var mainQueue = LoaderMax.getLoader("loaderQueue"); Thanks for your help as I get my head wrapped around event triggered coding Karl
×
×
  • Create New...