Welcome, Guest. Please login or register.
Did you miss your activation email?
05/21/12, 04:07
Home Help Search Login Register
News: Parsley Flex framework review featuring quiz application, in our Flex frameworks series
Flex SDK 4.5 mobile roadmap: begin with your mobile development
Swiz Flex framework review featuring quiz application
New homepage we release our new Homepage, take a look ...

+  Flash-db
|-+  Server side Scripting and Database Support
| |-+  Web Services: XML, Soap, WSDL, UDDI, and Flash Integration (Moderators: Flash-db, Musicman, vesa kortelainen, Ronald Wernecke, Jorge Solis)
| | |-+  Load istance from xml
0 Members and 1 Guest are viewing this topic. « previous next »
Pages: [1] 2 Print
Author Topic: Load istance from xml  (Read 6544 times)
abbatg
Guest
« on: 12/14/05, 06:19 »

Hello,
Is possible to load a istance(inside flash library)  from xml?
for ex:

I create a istance  called  istance1 and  I put like label "black"

Now I would to load this istance from xml... 

in xml

<book>
<author>frank</author>
<color>black</color>

</book>


now in flash is possible to create a code it call black like istance?
thanks
Regards





Logged
Jorge Solis
Administrator
Systems Administrator
*****
Posts: 14600


View Profile
« Reply #1 on: 12/14/05, 06:35 »

Using attachMovie you can set the instance name of the movie attached to Stage (second parameter of attachMovie)

Jorge
Logged

abbatg
Guest
« Reply #2 on: 12/14/05, 13:22 »

in this case:

if (success) {

testo3.text=this.childNodes[0].childNodes[2].firstChild;
            
        }

How i put  attachMovie?
consider this:
nome clip movie= nero

thanks

Regards
Logged
Jorge Solis
Administrator
Systems Administrator
*****
Posts: 14600


View Profile
« Reply #3 on: 12/14/05, 13:32 »

If this->this.childNodes[0].childNodes[2].firstChild; resolve to the string "hero", could be:

name = this.childNodes[0].childNodes[2].firstChild;
_root.attachMovie(name, name, 100, {_x:100, _y:100})

In the library should be a MovieClip with linkahe name hero

Jorge
Logged

abbatg
Guest
« Reply #4 on: 12/14/05, 15:27 »

doesn't work...
the xml tag is:
<colore>mero</colore>

it is about the node for "nero"
...
Hoseph
Logged
abbatg
Guest
« Reply #5 on: 12/14/05, 15:38 »

If this->this.childNodes[0].childNodes[2].firstChild; resolve to the string "hero", could be:

name = this.childNodes[0].childNodes[2].firstChild;
_root.attachMovie(name, name, 100, {_x:100, _y:100})

In the library should be a MovieClip with linkahe name hero

Jorge


in the library there is a istance (movieclip) called "nero"
I put this in the flash code:


_root.nero = this.childNodes[0].childNodes[1].firstChild;
_root.attachMovie(nero,nero, 100, {_x:100, _y:100})

but the movie clip called "nero"  but it doesn't diplay



Logged
Jorge Solis
Administrator
Systems Administrator
*****
Posts: 14600


View Profile
« Reply #6 on: 12/15/05, 02:19 »

Ok, first step: read flash help about attachMovie.Second: this is not the code I have posted. For further check (using my code):

name = this.childNodes[0].childNodes[2].firstChild;
trace(name) //should output-> hero
_root.attachMovie(name, name, 100, {_x:100, _y:100})


If the trace is not showing "hero", the node in the XML have another value.

Jorge


Logged

abbatg
Guest
« Reply #7 on: 12/15/05, 03:05 »

the trace works and done  nero
but I would tho kiad a clip movie  called nero and this doesn't show
the nero mc isa small rectanhle black..
Joseph
Logged
Jorge Solis
Administrator
Systems Administrator
*****
Posts: 14600


View Profile
« Reply #8 on: 12/15/05, 08:27 »

Have a linkage name?

Rigth click the MC on library, select linkage, Mark export for ActionScript and export in firts frame, write nero as the name. Then try again

Jorge
Logged

abbatg
Guest
« Reply #9 on: 12/15/05, 09:20 »

Have a linkage name?

Rigth click the MC on library, select linkage, Mark export for ActionScript and export in firts frame, write nero as the name. Then try again

Jorge
doesn't work.
I select the Mc in the library. In the prprerty i  marked "export for as" and I marked "insert in the first frame". I  gave the name "nero" .nut don't appear nothing. the image doesn't show!

I don't know...
Logged
abbatg
Guest
« Reply #10 on: 12/15/05, 09:25 »

remember the sml...
maybe is here the error?


<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="xmlstyle.xsl"?>

<maglietta>
<codice>123A01</codice>
<colore>nero</colore>
<taglia>42</taglia>
 </maglietta>


look at the colore tag--->nero


What do you think about?

Joseph
Logged
Jorge Solis
Administrator
Systems Administrator
*****
Posts: 14600


View Profile
« Reply #11 on: 12/15/05, 09:49 »

Should be:

this.childNodes[0].childNodes[1].firstChild

That's because I have added the trace, if it doesn't output-> nero, it will not work

Jorge
Logged

abbatg
Guest
« Reply #12 on: 12/15/05, 10:02 »

I'm sorry:
the output workd and gave nero
but do not show the mc back
 if (success) {
                testo.text =this.childNodes[0].childNodes[0].firstChild;
    name = this.childNodes[0].childNodes[1].firstChild

trace(name) //should output-> hero
_root.attachMovie(name, name, 100, {_x:100, _y:100})


            testo3.text =this.childNodes[0].childNodes[2].firstChild;
            
        }
};


I repeat: the output (ctrl+emter( gave a bero /word) but doesn't show the image.


Joseph
Logged
Jorge Solis
Administrator
Systems Administrator
*****
Posts: 14600


View Profile
« Reply #13 on: 12/15/05, 10:08 »

Nero, not bero
Ok, recheck the attachMovie command in Flash help and try harder, enough info.

Jorge
Logged

abbatg
Guest
« Reply #14 on: 12/15/05, 10:47 »

Someone else let me help please?

thank so much.
Joseph
Logged
Pages: [1] 2 Print 
« previous next »
Jump to:  


Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!