Home Tutorials Forums Articles Blogs Movies Library Employment Press

Go Back   ActionScript.org Forums > Flex > Flex 2, 3 & 4

Reply
 
Thread Tools Rate Thread Display Modes
Old 07-06-2009, 05:25 PM   #1
justme123
New Member
 
Join Date: Mar 2009
Posts: 27
Default how to set swf metadata.publisher to an ant property in the mxmlc task

Hi,

Is there a straight forward way to set metadata.publisher to the value of an ant property in the mxmlc task?

From the docs i'd have expected it to work like this:
Code:
<property name="publisher" value="Initrode Global"/>
<mxmlc [...]>
[...]
<metadata publisher="${publisher}"/>
</mxmlc>
But publisher is not a valid attribute for the metadata element.

So what about a nested element?
Code:
<property name="publisher" value="Initrode Global"/>
<mxmlc [...]>
[...]
<metadata> 
<publisher>${publisher}</publisher>
</metadata>
</mxmlc>
leads to this error when the task is executed:
"command line: Error: configuration variable 'metadata.publisher' value contains unknown token 'publisher'"

Replacing ${publisher} with a string works, so i guess it's the mxmlc task interpreting ${*} as something different (what does token mean in this context?!).

i also tried using the nested 'arg' element that mxmlc should have inherited from javac
Code:
<mxmlc [...]>
[...]
<arg value="-publisher='${publisher}'"/>
</mxmlc>
but it looks like that's being ignored aswell.

the only workaround i've found so far is to wrap the call to mxmlc inside a macrodef with an attribute for publisher (macrodef uses @{*} to reference its attributes and without the $ it works).

Code:
<macrodef name="mxmlcmacro">
<attribute name="publisher"/>
<mxmlc [...]>
[...]
<metadata>
<publisher>@{publisher}</publisher>
</metadata>
</mxmlc>
</macrodef>
but this workaround really messes up the readability of the buildfile, i'd really apreciate a clean solution.

tia, justme123
justme123 is offline   Reply With Quote
Old 07-07-2009, 12:53 PM   #2
Peter Cowling
quantum tunneler
 
Join Date: Sep 2008
Location: London, UK
Posts: 882
Default

Hi,

I expect that 'publisher' is reserved. So:

> Change your property name to something else i.e. IN_GLOBAL.

> Then your metadata entry to
ActionScript Code:
<publisher name="${IN_GLOBAL}"/>
Peter Cowling is offline   Reply With Quote
Old 07-08-2009, 09:39 AM   #3
justme123
New Member
 
Join Date: Mar 2009
Posts: 27
Default

Thank you!!!

although it's not a problem with the property name:

Code:
<property name="banana" value="Initrode Global"/>
<mxmlc [...]>
[...]
<metadata> 
<publisher>${banana}</publisher>
</metadata>
</mxmlc>
Error: configuration variable 'metadata.publisher' value contains unknown token 'banana'

using the 'name' attribute of the publisher element does work:

Code:
<property name="publisher" value="Initrode Global"/>
<mxmlc [...]>
[...]
<metadata> 
<publisher name="${publisher}"></publisher>
</metadata>
</mxmlc>
Do you know where these attributes are documented?
justme123 is offline   Reply With Quote
Old 07-08-2009, 09:51 AM   #4
Peter Cowling
quantum tunneler
 
Join Date: Sep 2008
Location: London, UK
Posts: 882
Default

I remember a document called 'Ant2Flex' or something similar document somewhere on the web, but don't remember where. It was a table that set out flex compiler attributes, against the Ant equivalents...

EDIT:
Does this not work though:

ActionScript Code:
<property name="banana" value="Initrode Global"/> <mxmlc [...]> [...] <metadata> <publisher name="${banana}" /> </metadata> </mxmlc>

Last edited by Peter Cowling; 07-08-2009 at 09:56 AM.
Peter Cowling is offline   Reply With Quote
Old 07-08-2009, 12:00 PM   #5
justme123
New Member
 
Join Date: Mar 2009
Posts: 27
Default

That also works, it's just a different property name. The problem with my first attempts was never the name (i actually don't use ${publisher} in the production file, i've just used it to provide a more readable example).

I didn't find the document you've mentioned jet, or even the source of the flex ant tasks (even if no documentation exists, the source code should tell what the attribute names are).
justme123 is offline   Reply With Quote
Old 07-08-2009, 12:27 PM   #6
Peter Cowling
quantum tunneler
 
Join Date: Sep 2008
Location: London, UK
Posts: 882
Default

Flex2ant document mentioned earlier.
Peter Cowling is offline   Reply With Quote
Old 07-08-2009, 12:50 PM   #7
justme123
New Member
 
Join Date: Mar 2009
Posts: 27
Default

Oh, i've seen that of course, but it's for flex2ant mxmlc task (org.flex2ant.Mxmlc) not adobes mxmlc task (flex.ant.MxmlcTask).

But i've found the source code by adobe, it's in <flex 3.3 sdk>/ant/src *duh*

The file ant/src/flex/ant/types/Metadata.java contains the information i needed:

date, description and title can be set as an attritute of the metadata element, others need to be nested elements:

Code:
<mxmlc [...]>
[...]
<metadata
 date="01.01.1970"
 description="this is an example"
 title="google me">
<publisher name="Initrode Global"/>
<creator name="justme123"/>
<contributor name="Peter Cowling"/>
<language code="EN"/>
</metadata>
</mxmlc>
I don't need localized-description and localized-title, so that's left as an exercise to the reader.

Thanks Peter!

Last edited by justme123; 07-08-2009 at 01:00 PM. Reason: added missing tag
justme123 is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 07:51 AM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.