2016-12-06 73 views
1

我想從彼此調用腳本:螞蟻:如何調用從另一個scriptdef腳本與屬性

<scriptdef name="script-to-call" language="javascript"> 
    <attribute name="myattr" /> 
    <![CDATA[ 
    var myattr = attributes.get("myattr"); 
    // ... do something 
    ]]> 
</scriptdef> 

我試試這個,但我得到了

TypeError: Cannot find function setMyattr

<scriptdef name="caller-script" language="javascript"> 
    <![CDATA[ 
    var task = project.createTask("script-to-call"); 
    task.setMyattr("some value"); 
    task.perform(); 
    ]]> 
</scriptdef> 

回答

0

這是解決方案:

var task = project.createTask("script-to-call"); 
task.setDynamicAttribute("myattr", "some value"); 
task.perform();