You must be logged in to post Login Register
Search 

Loading swf with XML on Click

User Post

3:32 am
August 24, 2009


Donkey Kong

Member

posts 8

1

Hi all, can anyone help

can anyone shine a little light onto a little confusion I am having, I have a menu that already loads in images via an XML file on a menu, what I am trying to do is when an image/meni Item is click I would like to load in an swf into the same place as the image Item loads into! am I making any sense.

on a click event, do I use in the XML file the link to swf   ????

this is what I have in my xml file that loads in the images so far;

title=”Lorem ipsum 12″
text=”Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Morbi commodo 12″ />

what I am getting confused with is what I also put within the AS, I am sure it is not alot but I'm just not sure what needs to go where??

this is what I have within the AS that loads in XML, I hope its ok to paste this code, never like posting to much code incase is scares people off, I just don't want to leave anything out, hope thats ok with everyoneSurprised

// Use URLLoader to load XML
   
   
xmlLoader = new URLLoader();
xmlLoader.dataFormat = URLLoaderDataFormat.TEXT;
   
// Listen for the complete event
xmlLoader.addEventListener(Event.COMPLETE, onXMLComplete);
xmlLoader.load(new URLRequest(“data.xml”)); 

stage.addEventListener( MouseEvent.MOUSE_WHEEL, onMouseWheel );

}
  

//———————————————EVENT HANDLERS
  
private function onXMLComplete(event:Event):void
  {
// Create an XML Object from loaded data
var data:XML = new XML(xmlLoader.data);
   
// Now we can parse it
var images:XMLList = data.image;
   
for(var i:int = 0; i < images.length(); i++)
   
   
{
// Get info from XML node
var imageName:String = images[i].@name;
var imagePath:String = images[i].@path;
var titles:String = images[i].@title;
var texts:String = images[i].@text;
    
    
// Load images using standard Loader
var loader:Loader = new Loader();
    
// Listen for complete so we can center the image

loader.contentLoaderInfo.addEventListener(Event.COMPLETE,onImageComplete);
loader.load(new URLRequest(imagePath));
   
// Create a container for the loader (image)
var holder:MovieClip = new MovieClip();
holder.addChild(loader);
   
var button_main:Button_mr = new Button_mr();   /
holder.addChild(button_main);               
   
var tooltip:ToolTip = new ToolTip();
tooltip.field.text = titles;  //loads tooltip 1
tooltip.field2.text = texts;  //loads tool tip 2
    
tooltip.x = -350; 
tooltip.y = 0;   
holder.addChild(tooltip);
    
    
// Same proceedure as before
holder.buttonMode = true;
holder.addEventListener( MouseEvent.CLICK, onMenuItemClick );
    
// Add it to the menu
circleMenu.addChild(holder);
    
 }
}

many thanks for any help!!!!!Confused

Topic RSS 
Search