Dynamically loading text into SWF
I'm building a flash web site and here are a couple parts of
the site the client is going to want to update regularly. Is there
a simple way that I can have an external file (XML?) that a client
can edit to update parts of the site without having to re-export
the swf or involve me, without getting into any real heavy
scripting?
Anything you can do to get me pointed in the right direction
would be greatly appreciated.
Thanks in advance.
Couple of quick questions... For the Textfields:
a)Do you have the textfields already on stage (in other words
your "5 or so" comment in your first post is fixed to the number of
textfields you put on stage). If so, what the names of the
textfields and in what scope (e.g. main timeline or inside a clip
called "textHolder" etc.
b)Or do you want them created dynamically by code? If they
are to be created dynamically by code, are they to be placed in
fixed (scattered) locations or is there a pattern - e.g. are evenly
spaced? If the positions are fixed and do not fall into pattern...
then what are they (in sequence) or if they are in a layout pattern
please describe it.
Similar Messages
-
Hello Everyone,
I wonder if anyone could help?
I have a SWF with multiple dynamic text fields. I want to
load in the contents of ONE text file into the five or so fields at
the touch of a button. Can anyone advise on how to set up a XML or
TXT file and the Action Script to allow this to happen?
Any advice or pointers in the right direction would be
greatly appreciated.
Darren.Couple of quick questions... For the Textfields:
a)Do you have the textfields already on stage (in other words
your "5 or so" comment in your first post is fixed to the number of
textfields you put on stage). If so, what the names of the
textfields and in what scope (e.g. main timeline or inside a clip
called "textHolder" etc.
b)Or do you want them created dynamically by code? If they
are to be created dynamically by code, are they to be placed in
fixed (scattered) locations or is there a pattern - e.g. are evenly
spaced? If the positions are fixed and do not fall into pattern...
then what are they (in sequence) or if they are in a layout pattern
please describe it. -
Problem displaying dynamically loaded text in Flash CS3
I created a Flash CS3 application that does not display
dynamically loaded text (from internal AS3 scripts) on 3/6 of my
client's computers. All computers run IE 6 and Flash Player 9. I
cannot replicate the problem on any computer in my department. The
problem seems to be related to Flash Player 9 or a browser
setting/IT restriction. Has anyone encountered this? If so, have
you found a solution?
If I cannot find a solution, then I will need to almost
completely redo the application.
One slightly insane idea I have considered is to, if
possible, convert dynamically loaded text to an image real-time. Is
that possible?
Btw, I have created a font in my library. Should I try
manually embedding the font from the Properties menu and selecting
all characters?
Thanks in advance.yes, even though you may be using a font from the library,
you still have to specify that each text field that uses that font
embeds the font, and you'll need to select all characters(well not
all, unless you require all the different scripts of the world -
upper-case, lower-case, numerals and punctuation usual suffices).
I bet if you checked, the computers where the font did not
appear did not have the font on their system.
Good luck
Craig -
How to dynamically load images into Flash
I have a movie clip on the stage that I want to dynamically
load images into (that constantly change), how would I go about
doing this? Thanks.Use the Loader class to load in images.
Then use addChild to add the Loader class into your MovieClip
on the stage.
As far as "constantly change" what
do you mean by that? You could use setInterval, ther enterFrame
event, or any other means to trigger a new image to be loaded into
the Loader instance.
Finally, you can use the Tween class to create some nice
effects for the images (fade it, blur in, photo blend, masks,
etc) -
How load text into dynamic text boxes from external file?
hi all,
my animation is very simple - a background image and 2 text boxes. one of the textboxes shows a large word, which crossfades to another word, with a total of about 12 words (showing one at a time in different text boxes fading in & out in the same spot).
i need a way to have the text be imported dynamically via xml or json (xml preferred). this article is a good start, but i noticed he's putting all of the text into one box - i need separate strings put into separate boxes from the xml.
Chris Gannon - Loading XML via AJAX into Adobe Edge
he uses
var outputField = $(this.lookupSelector(“xmlOutput”));
for his text box. what would be the best way to revise this code to include all my individual strings to be loaded into my individual text boxes? thinking an array might work, but my js skills are limited.
any other suggestions or tutorials you could point me to would be appreciated.
thanks!!thanks joel_pau !
this is helpful in seeing how the array is created, but after giving it a go I became a little confused.
i wound up trying it again based on the example i linked out to previously, but it's not adding the text from my xml file when previewing.
here's the code i'm using in edge animate on my stage. something must be wrong somewhere. let me know if you have any suggestions on this.
// insert code to be run when the composition is fully loaded here
// here i'm assigning a variable to each one of my textboxes at they're named in my edge animate comp
var outputField1 = $(this.lookupSelector("helps2"));
var outputField2 = $(this.lookupSelector("communicate"));
var outputField3 = $(this.lookupSelector("experience"));
var outputField4 = $(this.lookupSelector("interact"));
var outputField5 = $(this.lookupSelector("understand"));
var outputField6 = $(this.lookupSelector("overcome"));
var outputField7 = $(this.lookupSelector("flourish"));
var outputField8 = $(this.lookupSelector("collab"));
var outputField9 = $(this.lookupSelector("trust"));
var outputField10 = $(this.lookupSelector("grow"));
var outputField11 = $(this.lookupSelector("engage"));
var outputField12 = $(this.lookupSelector("survive"));
var outputField13 = $(this.lookupSelector("thrive"));
var outputField14 = $(this.lookupSelector("evolve"));
var outputField15 = $(this.lookupSelector("connect"));
var outputField16 = $(this.lookupSelector("achieve"));
$.ajax({
type: "GET",
url: "myxmlfile.xml",
dataType: "xml",
success: function(xml) {
//here i'm trying to load the the text in my xml file into my textboxes in edge animate. 'txt1, txt2, txt3' are the tags in my xml file
outputField1 = $(xml).find('txt1').text();
outputField2 = $(xml).find('txt2').text();
outputField3 = $(xml).find('txt3').text();
outputField4 = $(xml).find('txt4').text();
outputField5 = $(xml).find('txt5').text();
outputField6 = $(xml).find('txt6').text();
outputField7 = $(xml).find('txt7').text();
outputField8 = $(xml).find('txt8').text();
outputField9 = $(xml).find('txt9').text();
outputField10 = $(xml).find('txt10').text();
outputField11 = $(xml).find('txt11').text();
outputField12 = $(xml).find('txt12').text();
outputField13 = $(xml).find('txt13').text();
outputField14 = $(xml).find('txt14').text();
outputField15 = $(xml).find('txt15').text();
outputField16 = $(xml).find('txt16').text();
but nothing happens on preview. my textboxes still contain the original text that lives in my comp. -
Loading PDFs into swf dynamically
Is it possible to load a PDF into a flash app dynamically, much like you can with a jpg?
I know FlashPaper is available, but that doesnt do anything as far as allowing for dynamic loading if you need to load PDF dynamically
I need to load pdfs dynamically and get displayed after converted within Flash Player
Any Solution ?
ThanksCouple of quick questions... For the Textfields:
a)Do you have the textfields already on stage (in other words
your "5 or so" comment in your first post is fixed to the number of
textfields you put on stage). If so, what the names of the
textfields and in what scope (e.g. main timeline or inside a clip
called "textHolder" etc.
b)Or do you want them created dynamically by code? If they
are to be created dynamically by code, are they to be placed in
fixed (scattered) locations or is there a pattern - e.g. are evenly
spaced? If the positions are fixed and do not fall into pattern...
then what are they (in sequence) or if they are in a layout pattern
please describe it. -
How to style dynamically loading text?
Hi,
I am dynamically loading a .txt file into CS3 using
ActionScript 3.0. I want to style the text using CSS/HTML. The only
thing I can get to function using CSS/HTML is the "a tag", I can't
seem to get bold, colour, font, etc working. Should i be using CSS
or should I be doing this styling from ActionScript in the swf
files? I have checked the help files but I could get their tags to
work.
Any suggestions very welcome.
Thanks.you will have more control over all of this if you feed in an
xml file rather than a txt file. you can stipulate your class
attributes within the xml then
if you want to style the dynamic content using just your txt
file and the controls within the fla you could embed the typeface
glyphs you want to use within your output swf file and colour them
/ change weight etc within the fla
hope that is of some use
;-) -
To load text into clob,long.
I am able to load data into clob,long.but it is not taking more than 4000 bytes.but i want to insert 10MB or more data.HOW?
It is giving error ORA-01704:
string literal too long
Cause: A quoted string specified as a constant was too long.
Action: Quoted strings may not contain more than 2000 characters.
what it means? and tell me How can I insert more text ie upto 1GB.
thanking you.......
reddy.
nulldoes that
trace("Image Name=" +e.currentTarget.title)
trace what you want to display? if yes, add a textfield and assign its text property to e.currentTarget.title in your overScrollerItem listener function. -
Dynamically load content into a "template" swf from text file
I have a dream....
Well, I have a concept. I have not actively pursued Flash in
several years, though I've continued to have it in my arsenal. I've
not done much in the action scripting realm for a while though.
I am trying to create a template that will be used for about
100 different product pages.
It would have two tabs, basically, 2 different graphical
button sets. One will have up to 4 links to similar products, each
tab will be on the side of a square, and I need the ability to not
display a tab if there is no actual link.
As for the other tab, Its a menu that consists of a series of
lines. This can be an external menu, I just need a way to have
flash load the right menu. This menu, when you mouse over a line,
the name of the product appears, as well as a product image that
gets loaded with the menu. The product images would be external,
allowing me to simply replace an image if a new higher end version
of the product comes out.
So, I am totally not an actionscripter. Looks like I need to
load variables from an external file. Can I set a property in the
flash code on the html that tells the movie what dataset to grab
from?
Here's basically what I am looking for
property: value
(load variables for:)
item: 44
(menu1)
faster: 54b.html
slower: 34d.html
left: 43d.html
right: 45c.html
(menu2)
menu:graph5.swf
(menu loads images from external source)
link51: 51d.html
link52: 52c.html
link53: 53c.html
link54: 54d.html
link55: 55b.html
link56: 56d.html
A possible third menu would be text driven, and would use
html to link to various items.
This is a static site, so urls will be fixed.
Is it best to build a php page that serves up data for a
single item, or do one big text file with all 100 or so items? Is
that even possible?
My Flash since MX is very rusty. I am using Flash Pro8. I
would love to create a single file so modifications are to the text
files, unless a new item is released, then it's updating a single
flash menu and updating the text file.
Been spending way too much time in InDesign lately! I used to
be pretty good at Flash!well sorry there fanmap - but I don't think you're going to
be able to get this to work. here's why: the link points to a php
file - which gathers dynamic info from a DB - the return from the
php is generating a string that is based on the DOM and
'constructs' a javascript method that in turn writes to the html
document. although we can embed html into a textField in Flash
there are a limited number of supported html tags - and JS methods
will not operate internally. in addition, (i'm not certain someone
correct this if i'm off) there's no way to 'change' the output of
the php call, therefore you will not be able to read the return
because it is designed to use the DOM and write solely to the
current document. Even if you were to access the JS method from the
swf file (which one can) it will still only write the content of
the php return to the html document - and the output is not
compatible with the textField class. -
Load external image & text into SWF
Can someone point me to a tutorial on how to create a
template that will load an external image file,.css styled text
& a .css style sheet into a .swf by using .xml?
Thank you for your time.
CKYou can use the MovieClipLoader class to load multiple images sequentially (one at a time), but you wouldn't use a 'for' type of loop...instead you would use a recursive loop, where a loading function is called after each load completion until all loading in done. This is done by utilizing a load-complete listener to trigger loading of the next image. So you start the loading process by loading one file, when that file is determined to be loaded, the listener proceses that file in whatever way you need to prepared (resizing, etc) and triggers the loading of the next file.
If you look up the MovieClipLoader.addListener method in the Flash help documents there is an example there that uses the onLoadInit event. You would be wanting to use the onLoadComplete event. -
Can I dynamically import pdf into swf?
Hi All,
I need to be able to dynamically import an external pdf file into my flash .swf and display it within a movie clip on the timeline. --with pagination. Is this possible with Flash CS4?
Thank you for reading. I have been out of the flash game for about a year now. However, a situation has arisen where I need to create a swf movie that loads an external pdf, paginates it, and displays it within a movie clip in the swf. Is this possible or will I be forced to only provide a hyperlink to the pdf?
Thank you so much for your time.
PeteYou should be able to use getURL("pdflocationhere.pdf"); - but I believe thats totally dependent on how the users computer is set up. If they don't have Adobe Reader, it will probably fail, or will attempt to load the pdf within a modern browser that should have the reader plug-in. From my experience, when using getURL() within a projector, it will attempt to open the filetype based on that specific filetype's default opening program which is set in the OS.
-
Dynamically load xml into TextArea
How can I include text from an xml file (loaded using URLLoader) into a TextArea. Flex is stripping the brackets <, >, and mangling the text output.
thxTry the toXMLString() method.
-
Dynamically load fonts from SWF files
Hello,
9. Add code to register the fonts you embedded when the FontSWF is Loaded.
import flash.text.Font;
/*You will use the name of the font that was embedded and DF4. For example, in the example below Arial Black was embedded. Notice that underscores are used. These are added to the font name when it is embedded to create the font class name. If you embedded something like Times New Roman, you would use Times_New_Roman_DF4.*/
Font.registerFont(Arial_Black_DF4);
This sentences is following document page 6.
http://download.macromedia.com/pub/labs/textlayout/textlayout_flashcomponent_overview.pdf
How is a Japanese font?
example:
A-OTF Shin Go Pro M
Hiragino Kaku Gothic Pro W6
The following are the errors.
A-OTF_Shin_Go_Pro_M_DF4
Hiragino_Kaku_Gothic_Pro_W6_DF4
Best regards,Yes, you should be able to create an RSL that has a font in
it that can be used. See here for a tutorial on RSLs:
http://livedocs.macromedia.com/flex/2/docs/wwhelp/wwhimpl/common/html/wwhelp.htm?context=L iveDocs_Parts&file=00001524.html -
Dynamically Loading .jar into the AppletClassLoader of Signed Applet
First of all, I thank you for reading this post. I will do everything I can to be concise, as I know you have things to do. If you're really busy, I summarize my question at the bottom of this post.
My goal:
1.) User opens applet page. As quickly as possible, he sees the "accept certificate" dialog.
2.) Applet gets OS vendor, and downloads native libraries (.dll for windows, etc.) and saves them in user.home/ my new dir: .taifDDR
3.) Calls are made to System.load(the downloaded .dlls) to get the natives available.
4.) Applet downloads the .jar files that we stripped so that the applet was smaller, one by one
5.) For each .jar downloaded, it goes through the entries, decodes the .class files, and shoves them onto the AppletClassLoader.
6.) Finally, the looping drawmation of the applet is linked to a subclass, that now has everything it needs to do what it wants.
I have gotten all the way to step 5!!! It was amazing!
But now I'm stuck on step 5. I can download the .jar files, read them, even decode the classes!
As evidence, I had it print out random Methods using reflection on the created classes:
public net.java.games.input.Component$Identifier net.java.games.input.AbstractComponent.getIdentifier()
public final void net.java.games.input.AbstractController.setEventQueueSize(int)
public java.lang.String net.java.games.input.Component$Identifier.toString()
public final native void java.lang.Object.wait(long) throws java.lang.InterruptedException
... many many more So, its frustrating! I have the Class objects! But, whenever the applet begins to try to, say instantiate a new ControllerEnvironment (jinput library), it says ClassNotFoundException, because even though I made those Classes, they aren't linked to the system classLoader!
Here is how I am loading the classes from the jar and attempting to shove them on the appletclassloader:
ClassLoader load = null;
try {
load = new AllPermissionsClassLoader(new URL[]{new File(url).toURL()});
} catch (MalformedURLException e2) {
e2.printStackTrace();
final JarFile ajar = new JarFile(url);
... we iterate over the elements (trust me, this part works)
String name = entry.getName();
if (name.endsWith(".class")) {
name = name.substring(0, name.length() - 6);
name = name.replace('/', '.');
Class g = load.loadClass(name);
public class AllPermissionsClassLoader extends URLClassLoader {
public AllPermissionsClassLoader (URL[] urls) {
super(urls);
public AllPermissionsClassLoader (URL[] urls, ClassLoader parent) {
super(urls, parent);
System.out.println(parent);
public AllPermissionsClassLoader (URL[] urls, ClassLoader parent, URLStreamHandlerFactory factory) {
super(urls, parent, factory);
protected PermissionCollection getPermissions (CodeSource codesource) {
Permissions permissions = new Permissions();
permissions.add(new AllPermission());
return permissions;
}so, my assumption here is that if I create a new AllPermissionsClassLoader and then call loadClass, the loaded class (because it does return a valid Class object) is usable globally across my applet. If this is not true, how should I else be doing this? Thank you for Any advice you could offer!I know it's two years ago but the OP's approach seems pointless to me.
4.) Applet downloads the .jar files that we stripped so that the applet was smaller, one by oneWhy? Just name the JAR files in the CLASSPATH attribute of the <applet> tag. Then what you describe in (5) and (6) happens automatically on demand.
protected PermissionCollection getPermissions (CodeSource codesource) {Who does he think is going to call that? -
[JS][CS3] Loading text into memory
Hi.
Am am trying to access an external txt file which holds data for my script. I have looked at the famous "FindChangeByList" and tried to work from there. However, I am not going to need input from the user for the txt file location, it will always be the same:
myFilePath="/Mailer Support/savers.txt";//always going to be there
myFile = File(myFilePath);
myData = myFile.open("r", undefined,undefined);
myLine = myFile.readln(); //I know I need loops for this, but there is text on the first line of the TXT file
myText = myFile.read();
alert (myLine);//Blank!!
myText = myFile.read();
alert (myText);//Blank also
Can someone help with this please.
I know I had a PDF file that detailed the way to call and work with files, but I cannot find it. Does someone know the name of it?
Cheers
RoyYour code works just fine for me. I'd suggest adding
myStatus = myFile.open("r", undefined,undefined);
if (myStatus == false) { alert ("Unable to open that file"); exit(0); }
to check if it actually exists (open returns a state flag, rather than 'data'). A quick experiment shows that JS doesn't care if a non-existant file is opened for reading (other than just about any other programming language I could care to name!), and indeed "reads" blank lines if it doesn't exist.
By the way, you used this line twice:
myText = myFile.read();
-- overwriting "myText" the second time. Since the first "read" already read up to the end of the file, the second time around the variable is emptied.
Maybe you are looking for
-
Trackpad not working in the middle
I don't recall any moisture getting onto my trackpad recently but i do know that if my fingers are moist it doesnt move well. but my fingers are dry and along the right side of my trackpad it works perfectly. but when i move my fingers along to the m
-
Ea4500 new firmware bug (2.1.39.144146)
Cisco, How difficult is it to code firmware to give a list of MAC addresses connected to the router, can you hire me and I'll do it for you? The mysterious MAC address issue has been fixed with the newest firmware, now this issue has appeared.
-
There's one part of me that's been stuck in OS 9 for many years now (actually two, but fortunately the team at Unsanity has helped me on one issue). When I go to open a new folder in OS X.4, if it's a folder I've never opened before, the default view
-
NavigateToURL "_self" option not working.
I'm using the navigateToURL function in order to open a new html page. I want the new html page to replace the page that holds the swf. I'm using the "_self" option, but it's opening the window in a new tab in both FireFox and IE.
-
Hello everybody !! if i have: try{ //some code try{ //more code }catch(Exception e){ //dosomething //more coding }catch(Exception es){ }if an Exception occurs inside the second try, why is it caught by the first try??