Skip to main content
Known Participant
November 10, 2013
Question

How come my XML file ain't doing nothin' as a code snippet?

  • November 10, 2013
  • 1 reply
  • 1281 views

Hello people,

I made an XML file as follows. (See below - don't worry about the code & description, they're to be updated.)

When I go to the Code Snippets panel in Flash CS6 and click on "Import code snippets XML", and I click on my xml document, all seems to go well - but there is no added code snippet in my panel.

Anyone have any idea what's going wrong, here?

Thanks!

<?xml version='1.0' encoding='us-ascii'?>

<snippet>

<title>Draw a circle</title>

       <description>Draw a circle with (xcenter,ycenter) as middle point and a width of someNumber pixels.</description>

       <requiresSymbol>false</requiresSymbol>

       <code><![CDATA[

var myCircle:Shape = new Shape();

myCircle.graphics.beginFill(0x00CCFF);

myCircle.graphics.lineStyle(20, 0xCCCC99);

myCircle.graphics.drawCircle(130, 130, 100);

myCircle.graphics.endFill();

addChild(myCircle);

       ]]></code>

     </snippet>

This topic has been closed for replies.

1 reply

kglad
Community Expert
November 10, 2013

it's not clear you're loading that xml, but even if you do that successfully the loaded strings will NOT be interpreted by flash as code.

EhrenfestAuthor
Known Participant
November 10, 2013

Any idea how to do it, kglad? I thought I was following Adobe's instructions faithfully.

This is what Flash says to do:

To create your own code snippets copy the following empty one and paste it into the

category where you want it to appear.

    <snippet isBranch="false">

      <title>Custom Snippet</title>

      <description>This is an example of a custom code snippet.</description>

      <requiresSymbol>true</requiresSymbol>

      <code><![CDATA[

// Code goes here

trace("A custom code snippet");

      ]]></code>

    </snippet>

Of course, I can paste my code, and that works. But I want to make a separate XML file for use by other people, so this is the way I have to do it. And there IS the button "Import Code Snippets XML".

There has to be a way to do this, but I can't find it anywhere.

Any light on this, kglad? Or someone else

Ehrenfest

kglad
Community Expert
November 11, 2013

oops, my error.

i thought you were loading the xml dynamically using the urlloader.

after importing your xml what happens if you double click your code snippet while the actions panel is open and has focus?