Dcoo Posted December 1, 2013 Share Posted December 1, 2013 my gallery is loaded from an xml doc that is dynamically generated , when a user takes webcam picture the xml doc gets updated, I would like to add this new pic to the gallery. what would be the best way to do this? Link to comment Share on other sites More sharing options...
Carl Posted December 2, 2013 Share Posted December 2, 2013 Hi and welcome to the GreenSock forums. Not exactly sure what type of help you need. Once the xml gets updated and re-loaded, you would just need to grab the new url pass the url to a new ImageLoader load() the ImageLoader add the new image to your gallery Or perhaps you may have a LoaderMax that handles loading and displaying all the images, in that case you would just append() the new ImageLoader to your LoaderMax and then have the LoaderMax instance load the images. Link to comment Share on other sites More sharing options...
Dcoo Posted December 2, 2013 Author Share Posted December 2, 2013 "Once the xml gets updated and re-loaded" Its the re-laoding of the xml that am not sure how to do. Link to comment Share on other sites More sharing options...
Carl Posted December 2, 2013 Share Posted December 2, 2013 If you are using an XMLLoader to load it the first time, you can reload it like so myXMLLoader.load(true) setting the flushContent parameter to true will remove the previously loaded xml and reload the file again. Link to comment Share on other sites More sharing options...
Dcoo Posted December 3, 2013 Author Share Posted December 3, 2013 Thank you Carl, Is there possible an example of that code being implemented out there some where ? Link to comment Share on other sites More sharing options...
Carl Posted December 3, 2013 Share Posted December 3, 2013 No, not that I know of. This tutorial http://www.snorkl.tv/2011/08/loading-images-with-loadermax-part-2-the-xmlloader/ shows the basics of loading an xml doc and all the images listed in it, but it wasn't crafted to be loaded multiple times with new data. It seems you already are loading xml and images, not really seeing what the problem is with loading xml and image data again. Link to comment Share on other sites More sharing options...
Dcoo Posted December 4, 2013 Author Share Posted December 4, 2013 Yes I can get it to load the first time. so not one examples shows how use the reload button, as that is the function I can't seem to get to work. Link to comment Share on other sites More sharing options...
Dcoo Posted August 4, 2014 Author Share Posted August 4, 2014 I cant seem to get flushContent to work I have something missing from my code but not sure what. in my example below I'm not using xml, just loading one jpg If you are using an XMLLoader to load it the first time, you can reload it like so myXMLLoader.load(true) setting the flushContent parameter to true will remove the previously loaded xml and reload the file again. import com.greensock.*; import com.greensock.loading.*; import com.greensock.events.LoaderEvent; import com.greensock.loading.display.*; import flash.filesystem.*; LoaderMax.activate ([ImageLoader]); var file:String = "IMG_happy.jpg"; var mypic:File = File.applicationStorageDirectory.resolvePath("Photos/"+file); var myImage:ImageLoader = new ImageLoader(mypic.url,{container:this,x:0,y:0,width:414,height:309}); myImage.load(true); by the way, this code works in air on iOS to load a saved image from applicationStorageDirectory, if anyones interested Link to comment Share on other sites More sharing options...
Dcoo Posted August 4, 2014 Author Share Posted August 4, 2014 when a new picture is taken, it overwites IMG_happy.jpg in the photos folder, but doesn't update until the app is restarted import com.greensock.*;import com.greensock.loading.*; import com.greensock.events.LoaderEvent; import com.greensock.loading.display.*; import flash.filesystem.*; LoaderMax.activate([ImageLoader]); var file:String = "IMG_happy.jpg"; var mypic:File = File.applicationStorageDirectory.resolvePath("Photos/"+file); var myImage:ImageLoader = new ImageLoader(mypic.url,{container:this,x:0,y:0,width:414,height:309,onComplete:onImageLoad}); myImage.load(true); function onImageLoad(event:LoaderEvent):void { TweenLite.from(event.target.content, 1, {alpha:0}); } Link to comment Share on other sites More sharing options...
Carl Posted August 5, 2014 Share Posted August 5, 2014 The code you are showing appears to load an image once. I don't see where you are running code that calls myImage.load(true) again. Or perhaps where your app is being notified that the image has changed. Unfortunately I don't do any AIR for iOS development and ImageLoader was intended for http streaming so I'm not really sure how air is caching your image or what the problem might be. Sorry. Link to comment Share on other sites More sharing options...
Dcoo Posted August 5, 2014 Author Share Posted August 5, 2014 I don't think its has any thing to do with IOS, I cant get it to work in a browser But you say you don't see me call it again? Is it really the easy? I just call it again? Oh dang it is! it works!!I called it from my camera on save, Object(root).faceW.myImage.load(true); So cool! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now