Skip to content

Commit

Permalink
Updated snippets
Browse files Browse the repository at this point in the history
  • Loading branch information
davestewart committed Feb 21, 2012
1 parent bf85271 commit 4dc4fc2
Show file tree
Hide file tree
Showing 5 changed files with 87 additions and 20 deletions.
46 changes: 46 additions & 0 deletions user/assets/templates/as/class.as.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
package {package}
{
{>imports?}
/**
* {name}
* @author {author}
*/
public class {name} {extends?}
{
// ------------------------------------------------------------------------------------------------
// declarations

// stage instances

{>elements?}

// properties



// variables



// ------------------------------------------------------------------------------------------------
// instantiation

/**
* Constructor for {name}
*/
public function {name}()
{
initialize();
}

protected function initialize():void
{

}

// ------------------------------------------------------------------------------------------------
// methods

}

}
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
XUL
.factory('title:Propgate element names across frames')
.addRadiogroup('Rename using', 'type', {'First element name':'element', 'Layer name':'layer'})
.addRadiogroup('Style', 'style', {'camelCase':'camelCase', 'under_score':'underscore'})
.addRadiogroup('Style', 'style', {'camelCase':'toCamelCase', 'under_score':'toUnderscore'})
.addCheckboxgroup('Options', 'options', ['Only selected layers', 'Only animated layers'])
.show(onAccept);
})()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
this.data.elements = this.elements.join('\n');

// template
var template = new Template('/assets/templates/as/class.txt', this.data);
var template = new Template('/assets/templates/as/class.as.txt', this.data);

// variables
var path = this.data.package ? this.data.package.replace(/\./g, '/') + '/' : '';
Expand Down
2 changes: 1 addition & 1 deletion user/jsfl/snippets/Stage/Assign unique names.jsfl
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
xjsfl.init(this);
if(Get.selection())
{
XUL.create('title:Assign unique names,radio:Name after={Class or item name:class,Item Name:item,Path:path},radio:Style={camelCase:camelCase,under_score:underscore}', onAccept)
XUL.create('title:Assign unique names,radio:Name after={Class or item name:class,Item Name:item,Path:path},radio:Style={camelCase:toCamelCase,under_score:toUnderscore}', onAccept)
}

})()
55 changes: 38 additions & 17 deletions user/jsfl/snippets/Stage/Create test squares.jsfl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Create a set of test elememts you can play with
* @icon {iconsURI}Design/imaging/imaging_large_tiles.png
*/
function makeSquares(num, cols, gutter, setStage, clearStage)
function makeSquares(num, cols, gutter, style, setStage, clearStage)
{
// variables
num = num || 9;
Expand All @@ -25,26 +25,44 @@ function makeSquares(num, cols, gutter, setStage, clearStage)
}

// make square
if( ! lib.itemExists('square'))
var itemName = 'test square';
if(lib.itemExists(itemName))
{
lib.addNewItem('movie clip', 'square');
lib.editItem('square');
dom.addNewRectangle({left:-25, top:-25, right:25, bottom:25}, 0);
dom.selectAll();
dom.setFillColor('#FF000066');
dom.setStroke('#000000', 0.5, 'solid')
context.goto();
lib.deleteItem(itemName)
}

// make square
lib.addNewItem('movie clip', itemName);
lib.editItem(itemName);
dom.addNewRectangle({left:-25, top:-25, right:25, bottom:25}, 0);
dom.selectAll();
switch(style)
{
case 'red':
dom.setFillColor('#FF000066');
dom.setStroke('#000000', 0.25, 'solid');
break;
case 'grey':
dom.setFillColor('#777777');
dom.setStroke('#7777777', 0.25, 'solid');
break;
case 'black':
dom.setFillColor('#000000');
dom.setStroke('#000000', 0.25, 'solid');
break;
}

// switch back to original context
context.goto();

// variables
var collection = $('*');
var px = 0
var py = 0;
var rows = Math.ceil(num / cols);
var collection = $('*');
var px = 0
var py = 0;
var rows = Math.ceil(num / cols);
var x;
var y;


// update stage size
if(setStage)
{
Expand All @@ -67,15 +85,18 @@ function makeSquares(num, cols, gutter, setStage, clearStage)
var name = 'Item_' + Utils.pad(i + 1, 2);
if( ! collection.find(name))
{
lib.addItemToDocument({x:x, y:y}, 'square');
lib.addItemToDocument({x:x, y:y}, itemName);
dom.selection[0].name = name;
}
}
dom.selectNone();
collection = $('*').select();

// debug
fl.enableImmediateUpdates(true);

}
xjsfl.init(this);
XUL.create('title:Create squares,numeric:Total=[10,0,100],numeric:Columns=[5,1,100],numeric:Gutter=[5,0,100],checkbox:Set stage size=true,checkbox:Clear stage=true', makeSquares);
if(Get.dom())
{
XUL.create('title:Create squares,numeric:Total=[10,0,100],numeric:Columns=[5,1,100],numeric:Gutter=[5,0,100],dropdown:Style={Transparent Red:red,Grey:grey,Black:black},checkbox:Set stage size=true,checkbox:Clear stage=true', makeSquares);
}

0 comments on commit 4dc4fc2

Please sign in to comment.