How to run code after each other?
Hi there, a little question.
I call a function that returns the path of a new saved image as a string.
In that function I use a loader to load the image. After the image is loaded I set the url of the saved image and return it.
Next = id of the new saved image
Imageurl = the url of the image to load.
thumborfull = an indication to see if the thumb needs to be saved or the full image, so the thumb can be saved in a different folder than the full image.
My problem: when I call this function.. the return goes first, and then the loader complete. In the loader complete I set the new path of the image which i want to return.
So, my code runs synchronal, and not synchronic.. How do you get it to run synchronic?
Please some help.
code:
public var myimageurl:String;
public function saveImageFromInternet(next:Number, imageurl:String, thumborfull:String):String
var imgClass:Class;
//the second way
var loader:Loader;
//source code of the second way
loader = new Loader();
//notice: NOT _loader.addEventListener,is _loader.contentLoaderInfo.addEventListener
loader.contentLoaderInfo.addEventListener(Event.COMPLETE,function(event:Event):void
var loader:Loader = Loader(event.target.loader);
// width and heigt of selected image
var originalimgwidth:Number=event.target.width;
var originalimgheight:Number=event.target.height;
//put original image into bitmapdata
var bitmapje:BitmapData;
bitmapje=new BitmapData(originalimgwidth, originalimgheight, false, 0xFFFFFFFF );
bitmapje.draw(loader.content,null,null,null,null,true);
var newimagefile:File=new File();
if(thumborfull=="thumb")
newimagefile=docsDir.resolvePath("Tmtp/I"+next+".mtp"); //image path
myimageurl=newimagefile.nativePath;
else
newimagefile=docsDir.resolvePath("Fmtp/I"+next+".mtp"); //image path
myimageurl=newimagefile.nativePath;
var stream:FileStream = new FileStream; // create new filestream
stream.open(newimagefile, FileMode.WRITE); // open filestream
var data:ByteArray = encodeToJpg(bitmapje); // convert bitmapdata to a jpg bytearry
stream.writeBytes(data, 0, data.length); // writing the image
stream.close();
loader.load(new URLRequest(encodeURI(imageurl)));
return myimageurl;
If you are concerned that you are losing the url as it is not available from the complete event, you could use a custom event, which allows you to pass your own data into the custom event. Then in your custom complete event object you will still have the url.
http://livedocs.adobe.com/flex/3/html/help.html?content=createevents_1.html
Similar Messages
-
How to make videos automatically play right after each other?
I have four videos that I need to automatically play right after each other. For instance video1 plays and is done so video 2 should automatically start to play and then when video 2 is done video 3 should start and when video 3 is done video 4 should start and when video 4 is done video 1 should start. How do you code for this? Also, when a button is clicked whatever video is playing needs to stop and then the item that the button is linked to should show up whether it is another video or a graphic with scrolling text.
How do you use a complete listener? Can you give me an example of code to use or give me a link that has step-by-step instructions? I really would appreciate it.
-
Does anyone know how to make songs in your playlist play directly after each other with no break between then, ie no silent period?
you cannot.
-
Letting swf files expire after each other
Hello,
I would like to let several swf-files expire in the full
screen mode after
each other.
I load the films with
loadMovie("../../test2/res/test2.swf",1);.
How can I find out whether the film comes to an end so that I
can load the
next film?
BrianBecause you are loading into a level and not a container
MovieClip, you might consider on the last frame of the each
external swf _root.loadNext("../../etc/nextMovieName.swf")
in the main movie frame 1
function loadNext(swfUrl)
loadMovie(swfUrl,1);. -
When syncing 2 iphones to itunes how do you avoid getting each others apps
When you sync 2 iphones to itunes how do you avoid
getting each others appsFor some reason without syncing
when I download an app the 2 phones
get the same app. They are 2 different
phones with 2 different apple IDs -
How would 2 people call each other using facetime if both were in a foreign country but staying at different locations within that country?
It's tied to the Apple ID also - I believe it would use that to find the right person/device.
Perhaps this article would help: http://support.apple.com/kb/HT4319. It looks like you may want to go in through your contacts and make the call.
If you're concerned about data charges, put your phone in Airplane mode before trying to Facetime. That will prevent it from trying to make a call over your cellular data.
~Lyssa -
i can not use mac book air with samsung galaxy 3 to transfer files. i download the OS X 10.8.1 mountain line version the latest one...how can i introduce them each other?
Thanks how do I get the latest version then? online its asking me to submit address details and all sort and I'm not keen to do that, I'm working away from the city I bought it in and there is no Apple Store near me yet?
-
How to queue movie files to play after each other?
Hi,
I have home movies that I want to watch continually. I'm sick and tired of clicking on each file and playing it. I'd like to queue a selection of movies and just let them run one after another.
HOW do I do this? Help please!!
Thanks,
Chris.A web search hasn't revealed any immediate obvious answers, suggesting queueing is not a feature QT (maybe different in the Windows version).
I am only familiar with the cumbersome method as outlined in [http://www.ehow.com/how4453086present-multiple-movies-same-quicktime.html] where you copy (if only temporarily) multiple movies into one long movie.
Use something like http://niceplayer.net/ , or as I said, iTunes should be able to do this in a playlist since it is the .mov format.
Message was edited by: Limnos -
After installing IOS6 on my iphone 4 and my daughters iphone 4s we have this wonderful connection that we would like to break. We are now seeing/receiving each others text messages. I love my daughter but I don't really want to get all of her text messages from her friends and I don't really want to read every response she sends. Additionally, she can also see my text messages and there are times I really don't need for her to know everything that I am doing.
So It is time to cut the cord we need our own seperate texting. I am not sure what we did to have this happen but how do we undo it?Get your Apple ID sort out.
Only use the same Apple ID in Settings > iTunes & App Stores to share purchases, no where else.
Here some tips, it was written for IOS 5 but it's still valid for iOS 6.
iOS 5 & iCloud Tips: Sharing an Apple ID With Your Family -
me and my wife have iphones and ipads but we seam to get each others e-mails and would like to keep them seperate how do we do that when shareing one itunes acct
According the this: http://www.apple.com/mobileme/transition.html, "After moving to iCloud, family member accounts are no longer linked to the master account." You can share an iCloud calendar (see http://support.apple.com/kb/PH2690), but I don't think you will be able to share iCloud contacts unless you are signed into the same iCloud account on both phones.
-
How to run executable after installation?
Hi everyone,
I created an installer from one labview program with the application builder
of Labview7.1 for my customer, and this installer will be burned
on a CD. There are several configuration files which should be always
modified, so I want to give the customer a possibility that he can
change them by himself without creation of a new installer , I think the
"run executable after installation" is the way to do it, but I don't know
how to implement such an executable command to copy some files from CD to
the destination directory which the program should be installed, could
anyone give me some tips? Thans a lot!
LeWhen you setup your build file, add the files using SourceFile Tab>>add support files, then click on custom destination, here you can add support files during installation. Hope this is what you are looking for.
Paul
Paul Falkenstein
Coleman Technologies Inc.
CLA, CPI, AIA-Vision
Labview 4.0- 2013, RT, Vision, FPGA -
How to execute code after JSF startup?
Hello,
I need to execute some initialization code after JSF startup, so I cannot do the usual ServletContextListener trick, as that runs before JSF is completely initialized. Any ideas?
Kind regards,
UlrichI can think of one way to do this (which might be a bit cumbersome for what you are trying to do) : use the Spring framework's web integration classes.
You can specifiy a context listener in your web.xml :
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
That way, Spring will load an ApplicationContext, and in that context you can specify a Spring bean that will be instantiated at application startup, which will perform whatever logic you need to do.
More info here :
http://static.springframework.org/spring/docs/2.0.x/reference/webintegration.html -
How to place elements among each other
hi,
how can i place checkboxes among each other, so that i have such design:
checkbox 1 value 1
checkbox 2 value 2
checkbox 3 value 3
and so on...
i use following component:
<h:selectManyCheckbox>
<f:selectItems/>
</h:selectManyCheckbox>i've tried also these ones, but it didn't help:
<h:selectManyCheckbox>
<h:outputText value="<br>" escape="false"/>
<f:selectItems/>
<h:outputText value="<br>" escape="false"/>
</h:selectManyCheckbox>i always get all my checkboxes in one line:
checkbox 1 value 1 checkbox 2 value 2 checkbox 3 value 3
Maybe i can specify the style-attribute in <h:selectManyCheckbox> to force the line break?
anybody how already solved such problem?ok, i did it you say, but now i get an exception:
Could not find component 'tom' (calling findComponent on component 'imageForm:_id19:0:_id21')
here the code:
fill tomahawk component with selectedItems
<h:panelGrid columns="1" styleClass="myFont">
<h:column>
<t:selectManyCheckbox value="#{dataBean.selectedItems}" id="tom" onclick="this.form.submit()" layout="spread">
<f:selectItems value="#{dataBean.items}" id="selectTomaHawkItems"/>
</t:selectManyCheckbox>
</h:column>
</h:panelGrid>place tomahawk-components in dataTable
<h:panelGrid columns="1">
<h:column>
<h:dataTable value="#{dataBean.myList}" binding="#{MyDataBean.htmlDataTable}">
<h:column>
<t:checkbox index="#{MyDataBean.htmlDataTable.rowIndex}" for="tom"/>
</h:column>
</h:dataTable>
</h:column>
</h:panelGrid>and MyDataBean has following lines:
private HtmlDataTable htmlDataTable = new HtmlDataTable();
public HtmlDataTable getHtmlDataTable() {
return htmlDataTable;
public void setHtmlDataTable(HtmlDataTable htmlDataTable) {
this.htmlDataTable = htmlDataTable;
public int getRowIndex() {
return htmlDataTable.getRowIndex();
} -
We are recieveing each others texts, it has only happened since we upgrated to iOS6. We only get each others iMessages.
You have two issues: 1. iPad is designed for single person use, not multiple users like a computer is, 2. Everyone trying to use this "single person" device uses the same Apple ID. As far as iMessage is concerned, this is the same person...how would it know differently?
There is no solution to fix this. Even if everyone got their own Apple ID's, you're still trying to use a device, designed to be used by a single user, with multiple users. It simple is not gonna work, and if you manage to get it to work, it won't work very well. -
X61T - How similar are models to each other for swapping parts purposes?
I recently purchased an X61 Tablet at auction and am loving it. I got a great deal and it is exceeding my expectations already. (This isn't my first ThinkPad, though.)
However, part of getting a great deal on it is that it isn't perfect. It was sold as surplus, and saw years of constant use before it made its way into my hands. There are a few things wrong with it that I've noticed, including:
The center latch is loose. It locks, but it feels like someone who hadn't used a ThinkPad before pulled up on the top HARD a few times instead of using the switch.
The slot where the pen goes doesn't have a way of ejecting the pen: the piece that grabs on to the pen's clip had broken off and was blocking the entire slot, so I removed it. The way the part broke means that there is no easy way to reattach it.
I would like to get these fixed, eventually. Now for my actual question:
How similar are the different models of X61T to each other?
My computer is a 7764-CTO. I was thinking about just buying a 'for parts' X61T for these plastic pieces and to have some pieces to keep it alive for as long as possible. I'm assuming that the CTO ('configure-to-order') doesn't matter much and that any 7764 should work, but would a different model (e.g. 7767-XXX) be similar enough to buy for parts? I have reviewed the Hardware Maintenance Manual and they sometimes list different FRUs. However, it is difficult to tell to which FRU a part belongs (particularly the above parts). Moreover, I imagine that the FRUs may have different numbers but be functionally equivalent on occasion.
For practical purposes of cannibalizing parts from one X61T to another, how similar are the different models (776X) to each other? I would hate to buy a 'for parts' computer and have slight differences render it useless for my purposes. Thanks!X60T has a different (albeit swappable) LCD assembly, and utterly different palmrest and keyboard bezel. Couldn't tell you about the pen resting area since I've never looked into that...
Cheers,
George
In daily use: R60F, R500F, T61, T410
Collecting dust: T60
Enjoying retirement: A31p, T42p,
Non-ThinkPads: Panasonic CF-31 & CF-52, HP 8760W
Starting Thursday, 08/14/2014 I'll be away from the forums until further notice. Please do NOT send private messages since I won't be able to read them. Thank you.
Maybe you are looking for
-
I have figured out how to use PSE brilliantly with iPhoto by keeping (and saving) everything as jpeg's. But if I open from iphoto with PSE as my external editor, and save as a PSD, I am prompted to save in the iphoto library. However, when I go back
-
No captions in MobileMe gallery?
Is there no way to publish a MobileMe gallery with pics that have captions underneath them? I wrote the captions in the info pane of each pic in iPhoto, but when I published, the captions were not there. I hope I'm missing something, because not bein
-
Adding your iphone to your Airport express
Hi Folks I'm hoping that someone can help me to connect my iphone through my own broadband. I have an airport express but originally when I bought it someone else set up all the security settings for me. Can someone please advise me of how I can add
-
I am connecting a 2106 to our small network. If I set a specific port on the 2106 for the "guest interface" and wire that port directly to the DMZ is it still necessary to define a VLan? Does defining the ports separate the traffic? What I am think
-
_I was introduced to need for routinely trashing the caches about 7 or 8 days ago. In reading another thread concerning "disk images won't mount", the poster was advised to include such trashing. "Oh good", i thought "i needed to see that again !, fo