Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Defining height & width values of a movie clip with XML file!

New Here ,
Mar 19, 2013 Mar 19, 2013

How can I specify height and width values of a movie clip using external XML file? User needs to change values of a particular movie clip [rectangular shape] using xml file.

How can I do that?

Thanks.

TOPICS
ActionScript
697
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , Mar 19, 2013 Mar 19, 2013

With what part of the using an xml file to store and retrieve data are you having difficulty?  Do you know how to write the height and width values as data in an xml file?  It could be something as simple as the following...

<mc_dimensions>

      <mc_height>200</mc_height>

      <mc_width>200</mc_width>

</mc_dimensions>

Translate
LEGEND ,
Mar 19, 2013 Mar 19, 2013

With what part of the using an xml file to store and retrieve data are you having difficulty?  Do you know how to write the height and width values as data in an xml file?  It could be something as simple as the following...

<mc_dimensions>

      <mc_height>200</mc_height>

      <mc_width>200</mc_width>

</mc_dimensions>

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 20, 2013 Mar 20, 2013

Thanks for the xml code. How to define it in Flash Actionscript 3 so that it can retrieve height & width values from XML.

I have a rectangular called "Box1_mc" and I would like to manipulate the height & width values of that "Box1_mc" with XML file.

I have a sample code but don't know how to modify it to get my problem resolved.

function fileLoaded(e:Event):void

{

   xmlData = XML(loader_ul.data);

   m_txt.text = xmlData.March;

   a_txt.text = xmlData.April;}

How to modify this code to get height & width values from XML file?

Regards.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 20, 2013 Mar 20, 2013

For the xml data file content I showed it could be as simple as:

var xmlData:XML;

function fileLoaded(e:Event):void
{
   xmlData = XML(e.target.data);

   m_txt.text = xmlData.mc_width;
   a_txt.text = xmlData.mc_height;
}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Mar 20, 2013 Mar 20, 2013
LATEST

Following Ned's xml data, this code would work as well:

var mc_dimensions_XML:XML;

var mc_dimensions_width:Number;

var mc_dimensions_height:Number;

var mc_dimensions_XMLLoader:URLLoader = new URLLoader();

mc_dimensions_XMLLoader.load(new URLRequest("widthHeight.xml"));

mc_dimensions_XMLLoader.addEventListener(Event.COMPLETE, mc_dimensions_processXML);

function mc_dimensions_processXML (e:Event):void

{

    mc_dimensions_XML = new XML(e.target.data);   

    mc_dimensions_width = mc_dimensions_XML.mc_width;

    mc_dimensions_height = mc_dimensions_XML.mc_height;

    trace("mc_dimensions_width = "+ mc_dimensions_width);

    trace("mc_dimensions_width = "+ mc_dimensions_height);   

    Box1_mc.width = mc_dimensions_width;

    Box1_mc.height = mc_dimensions_height;       

}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines