Welcome, Guest. Please login or register.
Did you miss your activation email?
05/22/12, 16:43
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
|-+  General
| |-+  Flash and AS 3 (Moderators: papachan, kofi addaquay)
| | |-+  xml-> TileList help
0 Members and 1 Guest are viewing this topic. « previous next »
Pages: [1] Print
Author Topic: xml-> TileList help  (Read 1226 times)
gan4o
Server what's that
*
Posts: 22


View Profile Email
« on: 02/15/10, 15:05 »

i have a xml file ->
"<category>
   <item name = "Mercedes --E20056">
     <model>  Mercedes E20056 </model>
     <image>mercedes001</image>
    </item>
</category> ...5 models total
xml-> flash "load"-> TileList "click"-> some window with data
 here is the problem:
how to add another TileList in that window with few images /like a gallery/ - any ideas ?

i try with dataprovider and "
<item ....>
<photo name="photo1" url="mercedes01"></photo>
<photo name="photo2" url="mercedes02"></photo>
</item> 
but it loads all 30 photos ... in second TileList Sad
Thank you !
Logged
gan4o
Server what's that
*
Posts: 22


View Profile Email
« Reply #1 on: 02/15/10, 16:52 »

i fix it Smiley
Have a nice day - you can delete this post.
Thank you ! Smiley
Logged
gan4o
Server what's that
*
Posts: 22


View Profile Email
« Reply #2 on: 03/04/10, 05:47 »

have another problem Sad
here is the code :
var cnt_xml:XML = new XML();
cnt_xml.ignoreWhite true;
var 
xml_loader:URLLoader = new URLLoader();
xml_loader.load(new URLRequest("projects12.xml"));
xml_loader.addEventListener(Event.COMPLETEloadd);


function 
loadd(e:Event):void 
{
	

	
cnt_xml XML(xml_loader.data);
	
total cnt_xml.mercedes.length();
	
for( 
0totala++ )
	
{
	
	
model.pushcnt_xml.mercedes[a].model.toString() );
	
	
year.pushcnt_xml.mercedes[a].year.toString() );
	
	
price.pushcnt_xml.mercedes[a].price.toString() );
	
	
image.pushcnt_xml.mercedes[a].image.toString() );
	
	
desc.pushcnt_xml.mercedes[a].desc.toString() );
	
	
imgs.pushcnt_xml.mercedes[a].amedia.asset.toString() ); 
	
}
	
	


	
for(
0j<totalj++){
	
var 
btn:MovieClip = new mc();
	
btn.name "btn" a;
	
btn.mc.+ (mc.width +10) * ;
	
btn.mc.y;
	
btn.model_txt.text model[j];  
	
btn.price_txt.htmlText price[j];
	
btn.ui01.source image[j];
	
main_menu.addChild(btn);
	
btn.buttonMode true;
	

	
	

	
btn.addEventListener(MouseEvent.CLICKp_mov1);
	
btn.addEventListener(MouseEvent.ROLL_OVERpl1);
	
btn.addEventListener(MouseEvent.ROLL_OUTpl2);
	

	
function 
p_mov1():void
	
	
{
	

	
	
	
?
	
	
}
}

how to get data from movieclip ?
- i try ..but result was "undefined"
/have another movie clip with UILoader and 3 dynamic text fields/ ...help pls.
thank you !
« Last Edit: 03/04/10, 14:31 by Jorge Solis » Logged
Jorge Solis
Administrator
Systems Administrator
*****
Posts: 14600


View Profile
« Reply #3 on: 03/04/10, 14:33 »

Don't put the callback function inside the loadd function but outside.
The reference to the clicked MovieClip in callback is something like this:

Code:

function p_mov1(evt:MouseEvent):void{
  trace("target is "+evt.target)
}

Then use evt.target as a reference to the clicked MovieClip

Jorge
Logged

gan4o
Server what's that
*
Posts: 22


View Profile Email
« Reply #4 on: 03/04/10, 14:39 »

i find a error again - have no "String" Smiley
Logged
Jorge Solis
Administrator
Systems Administrator
*****
Posts: 14600


View Profile
« Reply #5 on: 03/04/10, 14:46 »

 Huh

Jorge
Logged

gan4o
Server what's that
*
Posts: 22


View Profile Email
« Reply #6 on: 03/04/10, 18:46 »

i mean:
	
     ...
desc.pushcnt_xml.mercedes[a].adesc.toString() );
	
	
imgs.pushcnt_xml.mercedes[a].amedia.asset.toString() ); 
	
	
}
	
}
	
loada();
}
function 
loada():void{
	

	
trace(j);
	
var 
model1:String=model[j];
	
var 
year1:String=yeara[j];
	
var 
price1:String=price[j];
	
var 
image1:String=image[j];
	
var 
desc1:String=desc[j];
        var 
imgs1:String=imgs[j];
	
var 
btn:MovieClip = new mc();
	
btn.mc001.+ (mc001.width +10) * ;
	
btn.mc001.y;
	
btn.model_txt.text model1;  
	
btn.price_txt.htmlText price1;
	
btn.ui01.source image1;
        
btn.buttonMode true;
	
main_menu.addChild(btn);
	
	
	

	
btn.addEventListener(MouseEvent.CLICKplaymov);
	
btn.addEventListener(MouseEvent.ROLL_OVERpl1);
	
btn.addEventListener(MouseEvent.ROLL_OUTpl2);
	
j++;
	
if (
j<total) {
	
	
loada();
}

have +1 problem
 imgs.pushcnt_xml.mercedes[a].amedia.asset.toString() ); 
shows
<asset><![CDATA[media/0001-p.png]]></asset>
how to fix it ?

xml looks like:
<mercedes>
    <
model><![CDATA[Mercedes E630]]></model>....
    <
adesc><![CDATA[2Lorem ipsum ...]]></adesc>
    <
amedia>
	
<
asset><![CDATA[media/0001-p.png]]></asset>
      
	
<
asset><![CDATA[media/0002-p.png]]></asset> .. x5
     
</amedia>
</
mercedes>
Logged
gan4o
Server what's that
*
Posts: 22


View Profile Email
« Reply #7 on: 03/08/10, 14:52 »

somehow i fix that and shows new problem - when i try to populate TileList :
Code:
var aImgs:DataProvider = new DataProvider;
aImgs.addItems(imgs2);
c_mov.ti002.dataProvider = aImgs;
content of <asset> /in xml file/ shows in "label" field on the tilelist cell
can i switch to "source" - i want images only
i try with
Code:
aImgs.addItems({source:imgs2});
but receve error : TypeError: Error: Type Coercion failed: cannot convert [object Object] to Array or DataProvider.
any ideas ? Thank you !
Logged
Jorge Solis
Administrator
Systems Administrator
*****
Posts: 14600


View Profile
« Reply #8 on: 03/09/10, 08:30 »

Don't use a CDATA node for just file names, instead normalize the filenames and use normal nodes

Jorge
Logged

Pages: [1] 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!
anything