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

That's the sad thing, k -

I click on Import Code Snippets XML, after which a window appears for me to browse to my xml file, I click on that xml file and the subwindow of the Code Snippets panel dutifully disappears. But....nothing happens. My code snippet does not show anywhere. Not in the Code Snippets window, where it should be (under Custom), nor even in the code that appears when you click "Edit Code Snippets XML".

Hence my wonderment: why did nothing get done with it?


1. open your snippets panel

2. click the setting icon (gear) and select export>save to a location you can remember

3. open that xml file in an xml/text editor and add your snippet above the go to web page snippet.

4. save

5. in flash import that file and open the actions folder and find your custom snippet. after selecting an onstage object double click your custom snippet.