View Full Version : Dynamically load text from .txt file
Panorado
05-04-2008, 12:30 AM
Title pretty much says it all... have a delimited .txt file and would like to dynamically load the text fields from it... should be simple enouph... no? Anybody done this before?
cheathamlane
05-04-2008, 12:52 AM
Hey Panorado:
Hmmm -- dynamically load the text into what? How is it delimited? Sounds like something needing to have an XML format wrapped around it...
Panorado
05-05-2008, 05:09 PM
"dynamically load the text into what?"
Strait onto the screen of the Pano Window. For Example... If I have thumbnails of the next tour, I would like to have 'text' labels ontop of them that comes from the .txt file.
"How is it delimited?"
Well, could be anything... commas... whatever but I use '&' because that's what works with SwishMax
File is pretty simple... just regular old .txt
Smith,Brown,702-111-1111,sb@yahoo.com
like that.
Actually... I prefer not to use .xml I love .xml but the database I use (Alpha 5) does not have a good .xml exporter.
The file would have to be 'loaded' separately from the .xml I think... with a 'plugin' maybe... OR... if the pano .xml could support dynamically loaded text at hotspots that would be great! I guess I could write a little program to swap in out my .txt data in the .xml file.
Oh man... I have to learn PHP and MySQL... enough with this local stuff... everthing is dynamic online these days!
Captain Canary
12-03-2008, 03:10 PM
Hi
I have been asked by a client if it is possible to dynamically load text from a database.
The idea is to have all hotspots show different text taken from the database.
Is this possible. If so could I see a sample and the code?
Many thanks
allSaints
12-07-2008, 11:19 AM
Panorado,
with the help of Trevor White, I have been testing a couple of solutions for providing a text box in FPP. I can't say I've come all the way yet, but at least they are working.
First, there is a plain text box plugin. The text in this box can be provided in two ways:
Directly in the XML file in the text="..." attribute of the <spot> tag.
From a separate file containing any number of texts, in which case you simply write text="#nn" in the XML file.
Both are handled with the same textbox.swf plugin, but if you want to use option 2 you also have to load the texts.swf plugin which handles the text collection file.
Of course you can set options as font, size, color, bgcolor, border and a few other things.
Secondly, I wrote a HTML plugin, htmlbox.swf, which can show a box containing the (pretty limited) HTML supported by the Adobe textField component. Here you also have two choices when providing the box content:
Directly in the html="..." attribute. Not very practical for more complex messages, because you have to encode all < > " ' characters as entities (ie. <...) in a XML file.
By using the htmlfile="..." attribute. In this case, all HTML is read from the file specified - and it doesn't have to be entity encoded :).
I have some test pages here:
simple text box (http://wirestam.com/panos/Flash/test/textbox.html), texts loaded from file (http://wirestam.com/panos/Flash/test/texts.html) and a HTML box (http://wirestam.com/panos/Flash/test/htmlbox.html)
Zip files (with plugin and documentation):
textbox.swf (http://wirestam.com/panos/Flash/textbox.zip), texts.swf (http://wirestam.com/panos/Flash/texts.zip), htmlbox.swf (http://wirestam.com/panos/Flash/htmlbox.zip)
XML files:
simple text box (http://wirestam.com/panos/Flash/test/textbox.xml), texts loaded from file (http://wirestam.com/panos/Flash/test/texts.xml), HTML box (http://wirestam.com/panos/Flash/test/htmlbox.xml)
Text file (http://wirestam.com/panos/Flash/test/mytexts.txt)
HTML file (http://wirestam.com/panos/Flash/test/meerkat.html)
Any form of constructive critizism would be received gratefully!
Regards,
Tommy
phberlin
12-07-2008, 02:56 PM
Hey allSaints,
wow, this really looks very promising! Thanks so much for sharing! Unfortunately, I don't have the time to give it a try and investigate all of its possibilities, but I surely will as soon as I have a chance to do so...
Thanks again! Philipp
Virtualguide
12-07-2008, 06:05 PM
aS,
just GREAT GREAT GREAT!
Thanks for sharing too!!!
Igor
broma
12-08-2008, 01:15 PM
Hi Tommy,
first of all thanks for sharing. I am asking you, is possible use <box> instead of <spot>? If yes please can make basic example.
Thanks for interest.
Bruno Napoli
phberlin
12-08-2008, 01:19 PM
@allSaints: I gave it a short go now and want to thank you again! It's really simple and straight forward.
The only problem I've realised is: If one uses either a comma (",") or a semicolon (";") in the texts, the text cuts up at the very position the character is used. Is there a way to have it also parse commas? Also, it simply does not parse special characters like the German umlauts ("д,ц,ь,Я") for example, although I tried setting "utf-8".
EDIT: Setting "charSet=iso-8859-1", "д,ц,ь and Я" are parsed perfectly :-) But I still could find no solution for commas and semicolons...
And I have a second suggestion/question: Could it be possible to use percentage values instead of absolute pixel values for width and height? This would be awesome for fluid design panos like in lightboxes and so on where you don't know the pano's dimensions...
Again, thanks a lot for sharing!
Philipp
allSaints
12-08-2008, 05:27 PM
Thank you guys for your being so quick to respond!
Some bugs that you can't find yourself always sneak into the code, so I might as well let you find them. :)
Philipp:
The texts from the text file always pass thru FPP, so that's why the comma and semicolon characters acts as delimiters. I should have thought of that! Well, it's fixed now - new zip files are uploaded.
Regarding the "едць" problem - I noticed your EDIT - fine, because I couldn't find any problems myself. Here (http://wirestam.com/panos/Flash/test/utftexts.html) is a link to a test page with utf-8 characters.
I'm not sure how you imagine setting width and height with a percentage. Maybe it's possible to get a resize event to wake up the plugin, get the pano size and resize the text box accordingly, but that would not change the size of the text font. Please tell me if I misunderstood your suggestion.
Bruno:
A <box> works just as well with the plugin. Here (http://wirestam.com/panos/Flash/test/textboxbox.html) is a test page. I included the "editor.swf" plugin so you can play with the settings. Just choose the "mytext" object in the editor.
Regards,
Tommy
broma
12-08-2008, 09:54 PM
Hi Tommy,
thanks again for quick response,
what I wanted to ask you is if there is the possibility to load mytexts.txt into <box>.
Thanks for interest.
Bruno Napoli
phberlin
12-08-2008, 11:40 PM
Philipp:
The texts from the text file always pass thru FPP, so that's why the comma and semicolon characters acts as delimiters. I should have thought of that! Well, it's fixed now - new zip files are uploaded.
Wow, you're superfast! :-) I'll try it out tomorrow (it's 1:45 in the night here right now)...
Regarding the "едць" problem - I noticed your EDIT - fine, because I couldn't find any problems myself. Here (http://wirestam.com/panos/Flash/test/utftexts.html) is a link to a test page with utf-8 characters.
Your utf-8 example works perfectly for me. So either you have fixed it now, or (more likely) I was just doing something terribly wrong :-)
I'm not sure how you imagine setting width and height with a percentage. Maybe it's possible to get a resize event to wake up the plugin, get the pano size and resize the text box accordingly, but that would not change the size of the text font. Please tell me if I misunderstood your suggestion.
By percentage, I meant in percent of the viewport (pano size). So if the pano is 400 px wide, "width=50%" would give 200. If the same panorama would be viewed bigger (e.g. browser maximized, compared to custom sized), 50% would be more accordingly than 200 px. I hope it's understandable what I mean by that? Sorry for my bad English..
Ah, and one last thing that just comes to my mind: The "width" and "height" parameters change the text box' initial size, right? But once the box is set up in the pano, changing its "width" value moves the box horizontally (and "height" vertically) and does not resize it. Is this meant to be like this?
Again, THANK YOU SO MUCH for this! It's greatly appreciated!
Best regards, Philipp
Panorado
12-09-2008, 03:10 AM
4 months later... but Thanks! Havn't been able to make it back to the boards as much as I like. I ended up doing somthing like you... just create an .swf, load it in a spot and have the .swf dynamically load text. Not a 'plug-in' just a spot. I will download your hard work and keep it on hand though, great work and thank you very much!
allSaints
12-09-2008, 07:14 AM
Hi Bruno
well, you can always load the text file through the "texts.swf" plugin by writing <box text="#nn" ...
But maybe I will add the possibility to read the text file directly from "textbox.swf" by writing textfile="....". That would give the same functionality as in "htmlbox.swf". I promise you I will look into it.
phberlin
12-09-2008, 03:48 PM
Hey Tommy,
I've had a closer look at it. Comma and semicolon work great now, as well as umlauts / special characters. Thank you much!
But I have realized the following: When you use textbox.swf as smart plugin in a box-object, it does first apperar as empty box (without text). This only changes if you call either "height" or "width" somehow, for example like:
onClick="height+=0;" makes the text visible when clicked on.
If in a spot-object, everything is shown from the beginning like supposed.
Also I wonder how one could change the text it refers to (like: "external.textbox.text=#2" or so?) Or even have it cycle though the texts, say as onClick event; something like: "Take the next text in the file, and if it's the last one, begin with the first again"?
Best regards, Philipp
allSaints
12-09-2008, 06:15 PM
Philipp,
I'm glad you are such a tough tester!
But I have realized the following: When you use textbox.swf as smart plugin in a box-object, it does first apperar as empty box (without text). This only changes if you call either "height" or "width" somehow, for example like:
That one is interesting - because it doesn't happen on this page (http://wirestam.com/panos/Flash/test/textboxbox.html). The XML file for this page is here (http://wirestam.com/panos/Flash/test/textboxbox.xml). But I'll try to look into this problem.
Ah, and one last thing that just comes to my mind: The "width" and "height" parameters change the text box' initial size, right? But once the box is set up in the pano, changing its "width" value moves the box horizontally (and "height" vertically) and does not resize it. Is this meant to be like this?
No, it's not supposed to change the position of the text box. But I discovered in the FPP documentation that default alignment of hotspot objects are Center-Middle, so changing the box size will move the box corners. By including align="TL" for (Top-Left) in the <spot> (or <box>) tag, it will keep its upper left position and grow to the right and downwards. I have updated the XML in my test links.
Also I wonder how one could change the text it refers to (like: "external.textbox.text=#2" or so?) Or even have it cycle though the texts, say as onClick event; something like: "Take the next text in the file, and if it's the last one, begin with the first again"?
Well, the textbox.swf is not an external plugin - the texts.swf is. So if I would change a property in texts.swf it gets a message from FPP. That's the channel I'm using to get the texts into the text boxes. But if I change a property in a textbox (ie. text="#n"), I'm not sure how the hotspot plugin can get a message. I will try to solve that issue too - I also think it's a very good idea to be able to change texts.
I'll be back...
Tommy
allSaints
12-09-2008, 10:07 PM
Sorry if this seems confusing, but the plugins are still in the development stage.
So, I have uploaded new versions of the zip files.
They can be found here:
textbox.swf (http://wirestam.com/panos/Flash/textbox.zip), texts.swf (http://wirestam.com/panos/Flash/texts.zip), htmlbox.swf (http://wirestam.com/panos/Flash/htmlbox.zip)
I have made two main changes:
In textbox.swf, the text can be read directly from a file with new parameter textfile="..."
The justify="..." parameter is renamed to textalign="..." and works a bit differently - hopefully more logical
Please see textfiles included with the zip files.
Philipp:
Please check the empty box problem again.
Regards,
Tommy
christophe
12-10-2008, 06:58 AM
Hello Tommy,
It's very kind to share your knowledge.
If i use your work, i will mention your name.
Thank you
Best regards
Christophe
broma
12-10-2008, 08:30 AM
Hi Tommy,
thanks to much for share your knowledge.
1. In textbox.swf, the text can be read directly from a file with new parameter textfile="..."
This not work for me... please can you make a basic example? Thanks again.
allSaints
12-10-2008, 09:56 AM
Hi Bruno,
Here (http://wirestam.com/panos/Flash/test/textboxfile.html) (XML (http://wirestam.com/panos/Flash/test/textboxfile.xml)) is a link to a hotspot <spot> that reads text from a file, and
here (http://wirestam.com/panos/Flash/test/textboxboxfile.html) (XML (http://wirestam.com/panos/Flash/test/textboxboxfile.xml)) is a link to a hotspot <box> that reads text from a file.
The <spot> link works OK, but the <box> link still has a problem (if you click on the text box, it will display the text).
I think there is some kind of timing problem when initializing the plugin and I will try to look into that tonight (I have my "real" job to manage during daytime).
Tommy
phberlin
12-10-2008, 02:47 PM
Philipp, I'm glad you are such a tough tester!
Not sure if this is a compliment or rather a circumscription for "demanding nitpicker", haha...
Sorry if this seems confusing, but the plugins are still in the development stage. So, I have uploaded new versions of the zip files.
If anyone here wants to complain about that, he's free to give you EUR 100,-- to make the process more straight forward. Just my opinion. Because I (and I'm sure others as well, also those who only read this silently without posting) am grateful for you sharing your hard work!
In textbox.swf, the text can be read directly from a file with new parameter textfile="..."
Works like a charm for me...
Philipp: Please check the empty box problem again.
I have. It's still the same issue. BUT -- one can circumvent it. I fiddled around a little and found out that having it 'change' the height directly in an onLoad-event does not work, so I did the following and it works perfectly:
onLoad="timer+=1,0,,showTextbox;"
showTextbox="textbox-id.height+=0;"
This goes directly in the box object that defines the very textbox. "textbox-id" of course has to be replaced with the corresponding textbox' id. So for example:
<box id="texttest" url="textbox.swf"
pan="166.00" tilt="0.00" distance="2.48"
rotationX="-11.00" rotationY="0" rotationZ="0"
alignX="-0.50" alignY="-0.56" depth="2"
scaleX="1.65" scaleY="1.63"
alpha="0.2" visible="1" blendMode="normal"
segmentsX="10" segmentsY="10" distorted="1"
width="350" height="240"
textfile="my-testtext.txt"
charSet="iso-8859-1"
scaleable="1" visible="1" mouseChildren="0" useHandCursor="0"
wordwrap="1" textalign="left" leftmargin="5"
font="Arial" size="10" color="#3366CC" bgcolor="#FFFFFF"
onOver="alpha=1,300;"
onOut="alpha=0.2,600;"
onClick="whirlAround();"
onLoad="timer+=1,0,,showTextbox;"
showTextbox="texttest.height+=0;"
whirlAround="rotationZ+=360,400;"
/>
Well, the textbox.swf is not an external plugin - the texts.swf is. So if I would change a property in texts.swf it gets a message from FPP. That's the channel I'm using to get the texts into the text boxes. But if I change a property in a textbox (ie. text="#n"), I'm not sure how the hotspot plugin can get a message. I will try to solve that issue too - I also think it's a very good idea to be able to change texts.
Sounds great. You probably know Zephyrs and Patrick's plugin architecture tutorial (http://flashpanos.com/tutorials/zephyr/understanding-basic-flash-panorama-player-plugin-architecture) (since you actually have written your own plugins already). If not, maybe it could be helpful regarding the above question. Since I have absolutely no clue about Flash/ActionScript, as I am only a simple ingenuous FPP user (sigh), I can unfortunately not help with this issue any better.
Thanks again for your efforts! It's much appreciated!
allSaints
12-11-2008, 07:17 AM
Philipp,
it annoys me a bit that the communication between FPP and an external plugin seems to be easier to achieve than between FPP and a hotspot "smart" plugin. And the interface is so poorly documented that you're kind of fumbling in the dark.
I have been testing with using textbox.swf as a <box> hotspot, and there must be something that differs in FPP - from a "timing" point of view - between a <spot> and a <box>, because FPP doesn't seem to quite "ready" with the <box> when I put the text into it.
Well, I'm going to test some more to try to solve it, as it's the last piece to make the plugin at least usable. Then you can always refine it and add more options...
For me this a case study to learn more about Flash and AS3, but of course it makes me happy if someone finds it useful :)
Tommy
Paddy2a
12-11-2008, 08:23 AM
Tommy,
This will be extremly usefull and thanks for sharing.
Paddy,
WideEyes
12-11-2008, 05:36 PM
Hi guys
I am not sure that I understand this thread correctly, but this is also a way to include text boxes in a tour: www.wideeyes.dk/temp/krybily - please click the "Info" button in the lower left corner to see it.
Regards
Morten
andrew22222
12-12-2008, 10:53 PM
Tommy,
When you complete the plugin, add a 'donate' button or a paypal email address to your post. I'll gladly transfer something as your going to help a %$@# load of people out with this project of yours ;)
Many thanks for doing it,
Andrew
allSaints
12-14-2008, 10:43 AM
Well, I think I have managed to fix the last issue with the text box plugin, and I have uploaded a new zip file for textbox.swf (http://wirestam.com/panos/Flash/textbox.zip). The other two plugins, htmlbox.swf (http://wirestam.com/panos/Flash/htmlbox.zip) and texts.swf (http://wirestam.com/panos/Flash/texts.zip) are the same as before.
The previous version suffered from some kind of timing problem when the plugin was used with a hotspot box to read the text from a file.
Here (http://wirestam.com/panos/Flash/test/textboxboxfile2.html) is a test page - when you click on the text it alternates between being a box and a spot (because there is a onClick="distorted+=1" function).
I want to thank everybody for your support, and I'm sorry panorado for capturing your thread.
Tommy
phberlin
12-14-2008, 12:56 PM
Tommy, you're a genius -- works like a charm now (box object, text loaded from file). Thanks a lot! That's all I can say...
broma
12-14-2008, 01:06 PM
Hi Tommy,
you have respected what you have promised, thanks a lot for your work.
Panorado
12-14-2008, 08:03 PM
Absolutely no reason to appologize for anything Tommy, For the amount of effort and function you brought to FPP with dynamic text, It's your's man! I'm just happy to have brought the question up and it has taken on such interest and utilization. Thank you very much and I hope many people use it as it is a great and needed function for FPP.
myksa
12-16-2008, 11:59 AM
First of all - great work!
But I tried to make an example with htmlbox, same as in the description of htmlbox plugin, and I can't make a link (<a href="">Asd</a>...), in FPP it's just a plain text.
Any ideas or examples how to make a working link?
If making url is possible, is it possible to assign a custom action to url? For example, when I click an url, I want to load another pano, or launch a function defined in xml file.
nikopol
12-16-2008, 02:26 PM
this is a wonderful plug-in to display the place name on the pano without using an image file for every pano. but it will be really perfect if we can dynamically change text="#1" parameter. for example:
onClick="loadPano(panoName=xxx); textbox.text=#12"
by this we can change the text when the user changes current pano.
please inform me if this is possible now with some kind of trick.
thanks for this great work.
allSaints
12-16-2008, 10:12 PM
Hi nikopol
Yes, that's definitely possible. As a matter of fact, I have uploaded a new zip file (http://wirestam.com/panos/Flash/textbox.zip) for the textbox.swf plugin that lets you do just that.
Here (http://wirestam.com/panos/Flash/test/texts.html) is a test page where clicking on the texts make them flip between two texts from the textfile. The XML file is here (http://wirestam.com/panos/Flash/test/texts.xml).
You are welcome to download and test it.
Tommy
phberlin
12-16-2008, 10:54 PM
Tommy,
brilliant, thanks again! Hhm, my findings: Textbox.swf alone (being given the text with "textfile=....." works in a distorted box (as you've fixed that some versions ago). But textbox.swf in combination with texts.swf (being given the text via <texts>text=....</texts> cannot be in a distorted box -- no text is shown then. So obviously there's something wrong with texts.swf that causes the distorted textboxes to show up incorrectly. Maybe some similar bug fix like with textbox.swf would be necessary here?
Regards, Ph.
allSaints
12-17-2008, 07:22 AM
Philipp,
my confidence in your ability when it comes to finding even the smallest bug is cemented, but in this case I'm one step ahead of you. :)
I noticed this bug yesterday when testing, and I tried applying the same solution that fixed the similar bug earlier. But there was no change and I havn't found the key to the problem yet. I'm sure it has something to do with timing, and it would be very interesting to hear what Denis had to say about the difference between a spot and a box.
I'll let you know,
Tommy
phberlin
12-17-2008, 02:58 PM
I'm looking forward to it.
allSaints
12-19-2008, 07:50 AM
So, here (http://wirestam.com/panos/Flash/textbox.zip) is my latest (last?) version of textbox.swf.
Hopefully the previous issue has been solved. The test page (http://wirestam.com/panos/Flash/test/texts.html) shows a couple of text fields that you can use.
XML file is here (http://wirestam.com/panos/Flash/test/texts.xml).
Regards,
Tommy
Captain Canary
12-19-2008, 10:00 AM
Many thanks for your help. As a newbie at FPP and xml even with your excellent test page samples and xml files I am experiencing problems. I can load the text box, but it populates with all the text from the .txt file even though I have only requested it to collect and show one line.
Here is the XML file:
<?xml version='1.0'?>
<panorama>
<parameters>
panoName = files/visualFiles/santiago
panoType = cylinder
segments = 20
layer_1 = files/plugins/cylConverter.swf
layer_2 = files/plugins/ffc_limits.swf
layer_3 = files/plugins/hotspots.swf
layer_4 = files/hotspotfiles/swf/textbox.swf
layer_5 = files/hotspotfiles/swf/texts.swf
</parameters>
<hotspots>
<global>
<spot id="mytext2" url="files/hotspotfiles/swf/textbox.swf" align="TL" pan="80" tilt="2" alpha="0.65" scaleable="0" visible="1" mouseChildren="0" wordwrap="0" textalign="center" font="Arial" size="14" color="#000000" bold="1" italic="1" underline="0" bgcolor="#A0E0FF" bordercolor="#0000FF" onOver="alpha=1,600" onOut="alpha=0.65,600" text="#2" textfile="mytexts.txt" />
</global>
</hotspots>
</panorama>
What am I doing wrong? Any help most appreciated.
myksa
12-19-2008, 11:27 AM
First of all - great work!
But I tried to make an example with htmlbox, same as in the description of htmlbox plugin, and I can't make a link (<a href="">Asd</a>...), in FPP it's just a plain text.
Any ideas or examples how to make a working link?
If making url is possible, is it possible to assign a custom action to url? For example, when I click an url, I want to load another pano, or launch a function defined in xml file.
Any help with my problem? I would appreciate any suggestions or working samples,
Myksa
allSaints
12-19-2008, 12:28 PM
Hi Captain
From your XML file:
layer_4 = files/hotspotfiles/swf/textbox.swf
layer_5 = files/hotspotfiles/swf/texts.swf
<spot id="mytext2" url="files/hotspotfiles/swf/textbox.swf"
align="TL" pan="80" tilt="2"
alpha="0.65" scaleable="0" visible="1" mouseChildren="0"
wordwrap="0" textalign="center"
font="Arial" size="14" color="#000000" bold="1" italic="1" underline="0"
bgcolor="#A0E0FF" bordercolor="#0000FF"
onOver="alpha=1,600" onOut="alpha=0.65,600"
text="#2"
textfile="mytexts.txt"
/>
I can see a couple of errors here:
layer_4 = files/hotspotfiles/swf/textbox.swf
First of all you should remove this line because you are already loading the textbox.swf plugin in the spot tag.
Then you should remove the textfile="mytexts.txt" attribute in the spot tag. It is not the textbox.swf plugin that reads the text file - it is the texts.swf external plugin. You include the textfile attribute only when all the text is going into this textbox, and then the text attribute is ignored.
And lastly, you tell the texts.swf plugin to read that text file by adding the following lines (see my XML file (http://wirestam.com/panos/Flash/test/texts.xml)):
<texts>
file=mytexts.txt
charSet=iso-8859-1
</texts>
Of course you substitute "mytexts.txt" with the path and name of your own text file. If some characters look strange try changing "iso-8859-1" to "utf-8".
You are welcome to email (tommy@wirestam.com) any questions.
Good luck,
Tommy
allSaints
12-19-2008, 12:48 PM
Hi myksa
But I tried to make an example with htmlbox, same as in the description of htmlbox plugin, and I can't make a link (<a href="">Asd</a>...), in FPP it's just a plain text.
Any ideas or examples how to make a working link?
If making url is possible, is it possible to assign a custom action to url? For example, when I click an url, I want to load another pano, or launch a function defined in xml file.
I'm sorry I forgot to answer your post.
To be honest I havn't managed to make any working link myself, and despite all my tests nothing seemed to happen when I clicked the links. Adobe's HTML support is very limited and they are very particular with their "sandbox security". I'm sure someone that knows the inner workings of Flash can explain that better.
However, I think if you can use an onClick event it would be easier.
Tommy
chadu
01-12-2009, 06:32 PM
I have encountered a strange bug related to putting external text into hotspots... if you have multiple browser windows open and they all hav ea local connection open sharing the same name, or if you have a multi-node VR tour and go back to a node you have already visited the Debug player brings up this error message:
ArgumentError: Error #2082: Connect failed because the object is already connected.
at flash.net::LocalConnection/connect()
at textbox_fla::MainTimeline/initHandler()
Any workarounds?
By the Tommy, really cool work, you are really pushing this!
allSaints
01-12-2009, 09:08 PM
Hi chadu,
yes, I'm aware of this bug and I am working on a solution.
I have two versions of this textbox plugin:
The first one uses LocalConnection and has the error that you describe. I understand why you get this error message, but I havn't found a practical solution yet.
The other version does not use LocalConnection, and can handle multiple browser windows, but when you have a multi pano tour and return to a pano with text boxes, they don't show. I have done extensive tracing of this version with lots of trace messages, but everything seems OK - the text box is there, and so is the text, but FPP just won't show it! The problem is the poor documentation of the hotspot API - you don't know what is happening inside.
As I said - I'm working on it - but no luck so far...
Regards,
Tommy
thanks a lot, Tommy, great work!!!
chadu
01-12-2009, 09:46 PM
Hi chadu,
yes, I'm aware of this bug and I am working on a solution.
I have two versions of this textbox plugin:
The first one uses LocalConnection and has the error that you describe. I understand why you get this error message, but I havn't found a practical solution yet.
I tried adding an _lc.close() in there but to no avail. Are there any other options for destroying/killing the _lc?
chadu
01-13-2009, 01:50 AM
allSaints,
Can you share the non-Local Coonection version of the plugin you mention? I'd like to try it out.
jordi
01-13-2009, 09:27 AM
Hi all, an excuse me for my ignorance...
I find this plugin extremly useful, in fact I always have used text box for adding a little writted info about the scene of the tour...
I was using a very bad software called TourWeaver from Easypano, I could do that function very easy, but now I need more features that's why I switched to FPP, and just find out a new world of unfinished features...
I wanted to ask it would be possible to do the same text box as I used to do before, here I attach an image where you can see an example of what I'm talking about :
http://caloliaire.com/fpp/textbox.jpg
Could we have like the Title, and then the description in a different style ??
Thanks in advance
allSaints
01-13-2009, 11:44 AM
Hi jordi,
you can of course use the htmlbox.swf plugin to mix text and images or different styles of text. But as the HTML and style support is very limited in Flash, you can only have one background color at a time. If you insist on having different background colors, then you have to divide your text into several boxes.
Regards,
Tommy
Trausti Hraunfjord
01-13-2009, 01:00 PM
Hi Tommy.
I have not tried out your text boxes, so forgive me if the question sounds silly.
Could one not make the background in different colours, as seen in Jordi's example, by using a png image, then place the text over it with transparent background, to get the same effect?
allSaints
01-13-2009, 03:13 PM
Hi Tuddi,
being swedish, it feels pretty strange talking to an icelander living so far away. :)
Yes, I read somewhere on the net that that's the way people usually do it: placing colored boxes underneath. To me it seems to be quite messy just to get a colored background. It would be so much easier if Adobe had simply implemented the property backgroundColor in their CSS support.
Regards,
Tommy
allSaints
01-13-2009, 04:58 PM
To chadu:
Here you go - the plugin without LocalConnection:
Note: if you use numbered texts (text="#nn"), you also need the corresponding texts.swf plugin.
textbox.swf (http://wirestam.com/panos/Flash/temp/textbox.zip)
texts.swf (http://wirestam.com/panos/Flash/temp/texts.zip)
Tommy
Trausti Hraunfjord
01-13-2009, 06:19 PM
I guess we Icelanders come in all sizes and distances :)
It would be good if one could easily add properties of own choice as needed... but that will probably have to wait until the world freezes over.
chadu
01-14-2009, 03:26 AM
Yeah, I was able to replicate that text disappearing bug... very odd indeed.
I have no idea what that could be.
A font problem? How about invalidating the display list? Forcing a stage redraw,etc?
chadu
01-14-2009, 07:47 PM
Tommy,
I have tracked the text disappearring bug down...
It appears that the width setting function is not resetting properly upon a revisit...
if (hotspot.getParam("width")) {
t.width = hotspot.getParam("width");
}
if (hotspot.getParam("height")) {
t.height = hotspot.getParam("height");
if (hotspot.getParam("width")) {
t.autoSize = TextFieldAutoSize.NONE;
}
simply commenting that out allows me to roam throughout a tour and revisti nodes with hotspots that contain text.
allSaints
01-15-2009, 06:18 PM
Thanks chadu - great work!
Unfortunately you lose the ability to manually set the size of the box, but I'm not sure that worked correctly anyway.
Here (http://wirestam.com/panos/Flash/textplugin.zip) is an updated zip file with all three plugins.
Regards,
Tommy
chadu
01-15-2009, 06:30 PM
Thanks chadu - great work!
Unfortunately you lose the ability to manually set the size of the box, but I'm not sure that worked correctly anyway.
Here (http://wirestam.com/panos/Flash/textplugin.zip) is an updated zip file with all three plugins.
Regards,
Tommy
No problem... the real power would be to have the hotspots be able to detect the text box's width and resize themselves to fit the text box.
I have something like that working, but when I do that, the alignment of the hotspot shifts... ideas on how to fix that?
allSaints
01-16-2009, 01:07 PM
No problem... the real power would be to have the hotspots be able to detect the text box's width and resize themselves to fit the text box.
I'm not sure what you mean by that, but what I meant, is that maybe you want the box to be for example wider than your text is. Then you can't let the textField component use autoSize, and you have to supply the width as a parameter.
Regarding the alignment of the spot - what kind of alignment do you use? align="CM" (center-middle of the hotspot) is default. I always use TL for my text boxes.
Tommy
chadu
01-16-2009, 05:27 PM
I'm not sure what you mean by that, but what I meant, is that maybe you want the box to be for example wider than your text is. Then you can't let the textField component use autoSize, and you have to supply the width as a parameter.
Regarding the alignment of the spot - what kind of alignment do you use? align="CM" (center-middle of the hotspot) is default. I always use TL for my text boxes.
Tommy
I have a textfield on stage in the hotspot file and a designed piece of art I am using as a background for the textfield. The art is named as an instance on the stage for the hotspots file in the layer directly below the hotspot... I'm attempting to do something like this:
// Timer event: look for numbered text string or new text in text attribute
function lookForNumberedText(event:Event) {
panoText = hotspot.getParam("text");
// do we have a numbered text string?
if (panoText.charAt(0) == '#') {
// yes - ask "texts.swf" to send it
timer1.stop();
switch (panoText.substr(1)) {
case "V": // show version
hotspots.execute(id+".text="+version);
break;
default: // get numbered text
hotspots.execute("external.texts.query="+id+"|"+panoText.substr(1));
break;
}
timer2.start();
}
else {
bg.width = hotspot.getParam("artwidth");
if (panoText != saveText) {
saveText = panoText;
panoText = saveText.replace("%2C",",");
panoText = panoText.replace("%3B",";");
t.text = panoText;
//trace("----------- "+id+": setting new text");
}
}
}
My edits ---- bg.width = hotspot.getParam("artwidth");
bg is the name of the movieclip behind the text box. artwidth is a prop I set in the xml so that I may scale the width o the scalenine grid enabled button.
When I use this, it pushes the bg to the left, and the text to the right, moving the copy of the art's bg.
Thoughts?
allSaints
01-16-2009, 06:10 PM
chadu,
I'm not an AS3 guru - I've only been doing this for a couple of months in my sparetime. Maybe it has something to do with the registration point of bg...?
Tommy
allSaints
01-16-2009, 06:19 PM
Hi,
After a request from nikopol, I have complimented the textbox plugin with the possibility to get the text in the textbox from an attribute of another hotspot.
So, in your textbox plugin you write:
text="*spotID.attr"
The important thing to remember is to start with an asterisk (*) to make the plugin understand that it is a reference to another attribute.
If you change the reference to another attribute or change the text in the attribute itself, the text in the textbox will be dynamically updated.
You can download the updated plugin here (http://wirestam.com/panos/Flash/textplugin.zip):
Regards,
Tommy
chadu
01-19-2009, 09:22 PM
chadu,
I'm not an AS3 guru - I've only been doing this for a couple of months in my sparetime. Maybe it has something to do with the registration point of bg...?
Tommy
Nope, not quite. Not sure where it's coming from, but altering hte ergistration only made it worse, really.
vBulletin® v3.7.1, Copyright ©2000-2012, Jelsoft Enterprises Ltd.