all groups > flash (macromedia) > august 2005 >
You're in the

flash (macromedia)

group:

Flash , XML with Japanese Text


Flash , XML with Japanese Text WizyWyg
8/30/2005 10:13:45 PM
flash (macromedia): I have a flash movie that imports data from an XML file (artist name, title
etc) and some of the data (artist's name) are in Japanese text. This
information is loaded into a dynamic text field within the flash movie

How do I get the flash movie to display the japanese text? If I "embed" the
Japanese Kanji within flash, my movie jumps from 56 kb to 1.6 megs? How can I
reduce the size of this? Or is there another way for Flash to parse the
Japanese text from the xml file?
Re: Flash , XML with Japanese Text WizyWyg
8/30/2005 10:39:40 PM
its a japanese audience (entirely), so that's my target. Unfortunately, Im
building this on an american operating system, so I dont see anything shwing up
correctly. How can i get it to display correctly for those "Japanese" who are
using American operating systems ( like our workers here do )
Re: Flash , XML with Japanese Text David Powers
8/30/2005 11:23:03 PM
[quoted text, click to view]

The simple way is not to embed the Japanese fonts. If the information is
aimed at a Japanese audience, they will have the fonts available on
their local computer. Of course, if the purpose is to make things look
"cool" for an international audience, you either have to embed the fonts
or serve the kanji up as graphics. If you do the latter, though, it
defeats the purpose of using XML.

There's no simple answer, but it basically depends on what your target
audience is.

--
David Powers
Author, "Foundation PHP for Dreamweaver 8" (foED - forthcoming)
Author, "Foundation PHP 5 for Flash" (friends of ED)
Re: Flash , XML with Japanese Text WizyWyg
8/31/2005 12:09:19 AM
Already installed.

I also think it has to do with the fact that the item that needs to display
the XML information, is a movie clip , containing the dynamic text field ( with
no characters embeded on the field ), and is "exported as ActionScript" and
"Export on First frame" and is linked to it via actionscript in the main movie
.. to be attached to a target_mc

1) The movieClip its called playlistItem, which contains the dynamic text
field that is used to show the playlist information from the XML file ( the xml
file is encoded UTF-8 ). However, on this dynamic text field, I have no
characters embeded, and the Text within the XML file is now not showing up.

2) in the main movie, i call for the playlitItem within this code:

//attacher: attaches the playlist movies, select() is called here
for(i = 0; i < numTracks; i++){
songInfo.content.songNum = i;
Pls.Playlist.playlist_mc.target_mc.attachMovie("playlistItem", "item" + i,
(i+1), songInfo.content);
Pls.Playlist.playlist_mc.target_mc["item" + i]._y = i * 18;
Pls.Playlist.playlist_mc.target_mc["item" + i].checkbox.gotoAndStop(2);
Pls.Playlist.playlist_mc.target_mc["item" + i].checkb=true;
if(Pls.Playlist.playlist_mc.target_mc["item" + i].title ==
songInfo.content[songNum].title){
Pls.Playlist.playlist_mc.target_mc["item" + i].gotoAndStop(2);
}
else{
Pls.Playlist.playlist_mc.target_mc["item" + i].gotoAndStop(1);


3) there is another dynamic text field on my main movie that the XML
information is displaying correctly ( no embedded fonts as well ) and show the
japanese text fine.




Re: Flash , XML with Japanese Text David Powers
8/31/2005 12:26:14 AM
[quoted text, click to view]

If you're using Windows XP, open Control Panel > Regional and Language
Options > Languages. Select "Install files for East Asian languages".
You may need the Windows Installation CD-ROM, and will probably have to
reboot.

--
David Powers
Author, "Foundation PHP for Dreamweaver 8" (foED - forthcoming)
Author, "Foundation PHP 5 for Flash" (friends of ED)
Re: Flash , XML with Japanese Text WizyWyg
8/31/2005 7:48:10 PM
Re: Flash , XML with Japanese Text NSurveyor
8/31/2005 8:05:07 PM
Try adding this before you load yoru xml:

Re: Flash , XML with Japanese Text WizyWyg
8/31/2005 8:16:53 PM
Originally posted by: NSurveyor
Try adding this before you load yoru xml:

System.useCodepage = true;

It doesn't work. I've tried it in several points in the movie ( first frame,
the first frame of the movieClip that is being exported out for ActionScript )
so on and so forth. It doesn't work.
Re: Flash , XML with Japanese Text FlashTastic
8/31/2005 8:17:08 PM
I've had extensive experience with XML and Japanese Characters... the
System.useCodePage method is not reliable as far as I can tell.

What you need to do.. and it's so simple (beleive me, I've tried many other
options).. is to paste the actual text characters right into the XML file and
set the textfield to use a font that has Japanese Unicode support (most
standard fonts can render this).

<sound name="button1">
<!-- Hiragana "A" -->
<character>?</character>
<audio>a.mp3</audio>
</sound>

If that doens't work, you might try using escape characters. This is how I
used to do it, but something changed in flashplayer 8 beta (I can't confirm
this is the problem, but I'm highly suspect) and they no longer work in Mozilla
based browsers. To find the character codes to use, go to www.unicode.org and
look up the Hiragana and Katakana unicode charts.

<sound name="button1">
<!-- Hiragana "A" -->
<character>&#x3042;</character>
<audio>a.mp3</audio>
</sound>

Cheers,

FlashTastic
Re: Flash , XML with Japanese Text WizyWyg
8/31/2005 8:18:42 PM
and without using this:
System.useCodepage = true;

I already have ONE text field that is working (showing the japanese from the
utf-8 encoded XML file ).

Its JUST not working for the "Export for ActionScript" movieClip (named
playlistItem)

Why? How can I get it to recognize the text from the XML file?
Re: Flash , XML with Japanese Text WizyWyg
8/31/2005 8:24:00 PM
Originally posted by: FlashTastic
I've had extensive experience with XML and Japanese Characters... the
System.useCodePage method is not reliable as far as I can tell.

As I've discovered. It isn't working in my situation.

What you need to do.. and it's so simple (beleive me, I've tried many other
options).. is to paste the actual text characters right into the XML file and
set the textfield to use a font that has Japanese Unicode support (most
standard fonts can render this).

<sound name="button1">
<!-- Hiragana "A" -->
<character>?</character>
<audio>a.mp3</audio>
</sound>


Im not following you on this.
For my XML file I have this as a line from it:
<song title="Spin" artist="?? ??" path="songs/Spin-Kazuaki_Nagai.mp3"
totaltime="00:0:30"/>

The text field in the main movie is set to _sans font ( so it should render
out japanese characters) and it works

The TEXT FIELDS within the movieclip that is "Exported for Actionscript"
(named playlistItem) are also set with the _sans font, but nothing is showing
up (its blank, nothing, zilcho, zero, non-existent).

So, i'm putting the japanese cahracters right into the XML file, yet one text
field renders it fine (since its on the main timeline) but the text fields
within the "Export for Actionscript" is not observing it.


If that doens't work, you might try using escape characters. This is how I
used to do it, but something changed in flashplayer 8 beta (I can't confirm
this is the problem, but I'm highly suspect) and they no longer work in Mozilla
based browsers. To find the character codes to use, go to www.unicode.org and
look up the Hiragana and Katakana unicode charts.

<sound name="button1">
<!-- Hiragana "A" -->
<character>&#x3042;</character>
<audio>a.mp3</audio>
</sound>

Cheers,

FlashTastic


Re: Flash , XML with Japanese Text WizyWyg
8/31/2005 9:29:09 PM
Could this be why it doesn't work:
Re: Flash , XML with Japanese Text FlashTastic
8/31/2005 10:09:30 PM
Are you able to post an FLA? or all code related to the playListItem? then maybe I can re-create it locally

Cheers,

Re: Flash , XML with Japanese Text WizyWyg
8/31/2005 10:39:30 PM
Unfortunately I can't ( some of the scipt contains private information)

can you try and build a simple fla file that calls for XML data to be
displayed for a dynamic text field within a movieclip (which is not on the
stage) and "Export for Actionscript" from the library and attach it to a movie?

sorry i can't provide source material.
Re: Flash , XML with Japanese Text FlashTastic
8/31/2005 11:28:45 PM
Okay, so I did a test, and It worked fine.... I wonder what the problem could
be?

testClip is a red square with a dynamic textbox on it (instance name:tbox),
no embedded fonts, characters, symbols, font set to _sans.

Here's the test actionscript.

var myXML:XML = new XML();
myXML.ignoreWhite = true;
myXML.onLoad = function(success) {
if (success) {
parseXML();
}
};
myXML.load("test.xml");
parseXML = function () {
_root.attachMovie("testClip", "test_mc", _root.getNextHighestDepth());
var rootNode = myXML.firstChild;
test_mc.tbox.text = rootNode.firstChild.firstChild;
};


And here's the XML:

<?xml version="1.0" encoding="UTF-8"?>
<JapaneseTest>
<character>?</character>
</JapaneseTest>



Re: Flash , XML with Japanese Text WizyWyg
9/1/2005 3:32:23 AM
Originally posted by: FlashTastic
Okay, so I did a test, and It worked fine.... I wonder what the problem could
be?

testClip is a red square with a dynamic textbox on it (instance name:tbox),
no embedded fonts, characters, symbols, font set to _sans.

Here's the test actionscript.

var myXML:XML = new XML();
myXML.ignoreWhite = true;
myXML.onLoad = function(success) {
if (success) {
parseXML();
}
};
myXML.load("test.xml");
parseXML = function () {
_root.attachMovie("testClip", "test_mc", _root.getNextHighestDepth());
var rootNode = myXML.firstChild;
test_mc.tbox.text = rootNode.firstChild.firstChild;
};


And here's the XML:

<?xml version="1.0" encoding="UTF-8"?>
<JapaneseTest>
<character>?</character>
</JapaneseTest>






I have no clue as to why its not working :

here is the code when its done loading the XML:

_parent.songInfo = new Object();
//returns the main information of the song as an object
function songInfoContent(inTitle, inImage, inArtist, inPath, inTotalTime) {
this.title = inTitle;
this.image = inImage;
this.artist = inArtist;
this.path = inPath;
this.totaltime = inTotalTime;
return this;
}
//returns
function playList() {
Length = songs.firstChild.childNodes.length;
_parent.songInfo.content = new Array();
for (i=0; i<Length; i++) {
_parent.songInfo.content = new
songInfoContent(songs.firstChild.childNodes.attributes.title,
songs.firstChild.childNodes.attributes.image,
songs.firstChild.childNodes.attributes.artist,
songs.firstChild.childNodes.attributes.path,
songs.firstChild.childNodes.attributes.totaltime);
}
}
_root.bufferSize = songs.firstChild.attributes.bufferSize;
playList();
_parent.play();
stop();



Could it be something in this?
Re: Flash , XML with Japanese Text urami_
9/1/2005 10:20:24 AM


[quoted text, click to view]

Well, the Japanese fonts are around 2mb so you can't reduce that, that it the size of the
outlines flash will use.
Try this article at
http://www.productbeta.com/tutorials/show.php?goomba=1&
All the info on how to deal with Unicode and special characters.

--
Regards

Urami

--


<urami>
http://www.Flashfugitive.com
</urami>

<web junk free>
http://www.firefox.com
Re: Flash , XML with Japanese Text FlashTastic
9/1/2005 7:20:13 PM
What happens when you trace the contents of _parent.songInfo.content, are all
the values from the XML showing properly?

Can you post the code where you send songInfo.content to the textfield
contained within playListItem after attaching it to the timeline?

AddThis Social Bookmark Button