Jump to content
Search Community

legali

Members
  • Posts

    8
  • Joined

  • Last visited

Profile Information

  • Location
    Glasgow, Scotland

legali's Achievements

0

Reputation

  1. Thanks Carl, you were spot on. Cheers!
  2. Hello all, I am having a problem with sequencing tweens. My uneducated guess is that this possibly stems from an automatic overwrite of earlier tweens in the sequence. I am trying to create a basic banner; with panning and fading characteristics. I have two image containers (mainPicArea / mainPicArea2), and images are dynamically loaded into alternate containers according to the number of children in each container (eg. if mainPicArea has one child, the image loads into mainPicArea2, and vice versa). Both containers are defined as having an alpha property of 0 when they are added to the stage. Having tried to check what I can with trace statements, I think the principle is working ok - images are being added to alternate containers, and then subsequently removed following completion of the tweening. However, when launched at runtime, nothing displays. My tweens and associated code is as follows (please note numbers "(1) (2) and (3)" are not part of the code but have been added by me just now): private function _containerHandler (mainPicArea:MovieClip):void{ (1) TweenLite.to(mainPicArea, 2, {alpha:1}); (2) TweenLite.to(mainPicArea, 5, {physics2D:{velocity:20, angle:getRandom(0, 360), overwrite:2}}); (3) TweenLite.to(mainPicArea, 2, {delay:5.1, alpha:0, onComplete:_removeChild, onCompleteParams:[mainPicArea], overwrite:2}); } private function _containerHandler2 (mainPicArea2:MovieClip):void{ (1) TweenLite.to(mainPicArea2, 2, {alpha:1}); (2) TweenLite.to(mainPicArea2, 5, {physics2D:{velocity:20, angle:getRandom(0, 360), overwrite: false}}); (3) TweenLite.to(mainPicArea2, 2, {delay:5.1, alpha:0, onComplete: _removeChild, onCompleteParams:[mainPicArea2], overwrite:2}); } private function _removeChild(param1:MovieClip):void{ param1.removeChildAt(0); trace("removing : " + param1.alpha); TweenLite.killTweensOf(param1, {alpha:true, x:true, y:true}); param1.x = 0; param1.y = 0; param1.alpha = 0; } When I disable lines (2) and (3) (i.e. the second and third tweens in the sequence, the containers (with the added images) tween in as expected. Then if I enable either lines (2) or (3) and run, nothing displays again. I have played about with defining each tween such that there should be no overwrite (overwrite:0), but that has made no difference. Can anyone shed some light on what I am doing wrong. Sorry if I have missed something really obvious. Thanks Ali
  3. Carl Many thanks for your detailed response. You answer to my 3rd query: While I follow the logic of establishing a variable to store the data received from the ImageLoader, I am still a little confused on the naming conventions. Would I be correct in thinking it comes down to personal preference, and you could - to take your example - have two different names to refer to the same content; eg. myImage and "porsche"? Are there reasons why you would want to reference using the variable (myImage) as opposed to LoaderMax.getContent()? In your example - although I appreciate it is an example - what would the name "car.jp" generally represent within the constructor? Are you able to provide a very generic pattern for constructing new loaders using the greensock loader class; eg. var newImage = new ImageLoader("url(?)"{name: custom name?; container: ect..., onComplete: handler funtion}) I hope these questions make sense. I really appreciate your help and advice with this. Kind regards, Alistair
  4. Thanks! I think my main problem is I do not have a good grasp of how the greensock Loader classes work in sourcing, loading, then displaying content. I was just getting to grips with the Flash Loader class; and now I have made the move to a class which I am -probably unequipped- to fully understand. My understanding of what I am trying to achieve in the code below is to create an array which will hold specified data elements from the xml file; namely, a picture title, picture description, path to thumbnail and path to full image. This is done by looping the 'data extracting' function for as many times as there are images in the xml file. Once the array is populated with the specified data, each element can then be called and worked with a method: this is achieved by naming each element as the data is pushed into it (by creating a new instance of the Slide class for every image held in the xml). When it comes to creating a new instance of the imageLoader for (i) the thumbnails, and (ii) the full image, I am not too sure how the syntax convention operates. I have looked at the class documentation, but find it quite overwhelming. My understanding is that: 1) for each image, I create a new ImageLoader which will be named according to the particular child node "thumb_path". 2) Then the curly brackets are opened: presumably everything within the brackets sets the properties / event handlers for the instance? 3) a name is given: is this an instance name? How does this differ from the name given to the loader, at point 1 above? 4) I have then specified a container, into which the image is to be loaded. For the thumbnails, I think this is fine as I want them to appear straight away; but for the full images, which will only display once the appropriate thumb is clicked, should this be omitted? (Although, the caveat to that is that, on startup of the gallery, I am trying to load a random image into the image container, with the code var a:Number = my_images.length(); var randomNum:Number = Math.round( Math.random() * (a - 1) ); //chooses a random picture to load first. initialLoadQueue.append(_slides[randomNum].imageLoader); //make sure the first random full-sized image is loaded initially too. I'm not sure whether this will work.) If a container is not specified, how are the full images displayed on screen? Would something like the following be used? var image:ContentDisplay = LoaderMax.getContent If so, what would the target be? The imageLoader name? 5) The remaining properties / event handlers are I understand optional - and will save trying to get my muddled head around those for another day. 6) What is it Despite being uncertain on how to formulate the syntax properly for the ImageLoader class, am I anywhere near understanding this? I would be so grateful for any input on my queries; or any useful - beginner - articles that I should check out. Kind regards! Ali
  5. Hi all Sorry, I've also posted this on the xml page - not quite sure which category it falls under. I am having difficulty with a gallery project I am trying to put together based on the sample slideshow available on this site. The problem relates to reading the thumb and image paths in the xml file. The error that is coming back is: Loading error on ImageLoader 'loader1' (assets/thumbs/): Error #2035: URL Not Found. URL: file:///C|/Documents%20and%20Settings/Alistair.HOME/Desktop/AB%20gallery%20proj/assets/thumbs/ ---- ---- Loading error on ImageLoader 'loader3' (assets/thumbs/): Error #2035: URL Not Found. URL: file:///C|/Documents%20and%20Settings/Alistair.HOME/Desktop/AB%20gallery%20proj/assets/thumbs/ ---- ---- Loading error on ImageLoader 'loader5' (assets/thumbs/): Error #2035: URL Not Found. URL: file:///C|/Documents%20and%20Settings/Alistair.HOME/Desktop/AB%20gallery%20proj/assets/thumbs/ ---- etc. I have debugged the code and can see, I think, that the xml is loading and is being parsed. So, that makes me think I am not defining my thumb and image paths correctly. Any help would be greatly appreciated! I will post the function, followed by a sample of my xml. Thanks private function _xmlCompleteHandler(event:LoaderEvent):void { _slides = []; var xml:XML = event.target.content; //the XMLLoader's "content" is the XML that was loaded. columns = xml.@COLUMNS; my_x = xml.@XPOSITION; my_y = xml.@YPOSITION; my_thumb_width = xml.@WIDTH; my_thumb_height = xml.@HEIGHT; my_images = xml.IMAGE var imageList:XMLList = xml.image; //In the XML, we have nodes with all the info we need. //loop through each node and create a Slide object for each. for each (var image:XML in imageList) { _slides.push( new Slide(image.@picture_desc, image.@picture_title, new ImageLoader("assets/thumbs/" + image.@thumb_path, {name:image.@thumb_path, container:_thumbnailsContainer, width:xml.@WIDTH, height:xml.@HEIGHT, scaleMode:"proportionalInside", bgColor:0x000000, estimatedBytes:13000, onFail:_imageFailHandler}), new ImageLoader("assets/full_images/" + image.@picture_path, {name:image.@picture_path, container:_imagesContainer, scaleMode:"proportionalInside", bgColor:0x000000, estimatedBytes:820000, onFail:_imageFailHandler}) ) ); } //end for loop //now create a LoaderMax queue and populate it with all the thumbnail ImageLoaders as well as the very first full-size ImageLoader. We don't want to show anything until the thumbnails are done loading as well as the first full-size one. After that, we'll create another LoaderMax queue containing the rest of the full-size images that will load silently in the background. var initialLoadQueue:LoaderMax = new LoaderMax({onComplete:_initialLoadComplete, onProgress:_progressHandler}); for (var i:int = 0; i < _slides.length; i++) { initialLoadQueue.append( _slides[i].thumbnailLoader ); } var a:Number = my_images.length(); var randomNum:Number = Math.round( Math.random() * (a - 1) ); //chooses a random picture to load first. initialLoadQueue.append(_slides[randomNum].imageLoader); //make sure the first random full-sized image is loaded initially too. initialLoadQueue.load(); _setupThumbnails(); } <?xml version="1.0" encoding="utf-8"?> full_images/image1.jpg thumbs/thumb1.jpg Acrylic on Board, Adam Smith 2008 "His Light Cast A Shadow" - Available $2000 full_images/image2.jpg thumbs/thumb2.jpg Acrylic on Board, Adam Smith 2008 "At the End of a Shadow" - Available $1000 full_images/image3.jpg thumbs/thumb3.jpg Acrylic on Board, Adam Smith 2008 Just Watch Yourself - Sold
  6. Yes, that helps a lot. Thank you very much - things are starting to become clearer (slowly). I've a long, long way to go with all of this. Thank you for your time and for all your work on the website. It is very much appreciated. Ali
  7. That's great - thank you. The AS files are clear to follow, although I do need to think about them. Can you tell me, are the .as files imported into the fla file as I cannot understand how the files are linking with each other. I cannot see any actions in the .fla; are they hidden in sub-layers? Sorry if this is very obvious. Thanks again! Ali
  8. I'm am also trying to work through a project similar to this at the moment. I am really new to AS3 but am trying to get to grips with it all asap. I would like to have a gallery (capable of holding many images) where the main container holds all content, with various main pic loaders loading into it on the click of corresponding thumbnail. There will also be image labels / descriptions loading simultaneous to the new main pic loading in. I would like a crossfade transition between the old main pic and new main pic. Once new main pic has loaded fully and the tween is finished, I would like to clear old main pic from holder. Is all of that possible? And if so, can anyone offer some help with how I can started with this as it has me really stumped. I hope to have more of an understanding about all this soon! Many thanks in advance. Regards Ali
×
×
  • Create New...