1. Meta Data.
<meta name="WT.z_mktmsite" content="Facebook">
<meta name="DCSext.pCC" content="Global">
<meta name="DCSext.pLL" content="en">
<meta name="DCSext.pSA" content="TestTab">
<meta name="DCSext.pPID" content="Test_en_Global_Facebook_TestTab">
2. Add script into the top of body.
<script type="text/javascript">
var _tag1 = new WebTrends();
_tag1.dcsid = "ddwe343434434";
_tag1.domain = "statse.webtrendslive.com";
_tag1.dcsGetId();
var _tag2 = new WebTrends();
_tag2.dcsid = "der34343434";
_tag2.domain = "ssdc.test.com";
_tag2.fpcdom = _tag1.fpcdom;
_tag2.onsitedoms = _tag1.onsitedoms;
_tag2.dcsGetId();
</script>
3. add a tag.
<a href="mailto:facebook@test.com" onClick="dcsMultiTrack('DCS.dcsuri', '/Plastics_en_Global_Facebook_Test-clickEmailFBSupport','DCSext.pPID','Test_en_Global_Facebook_Test-clickEmailFBSupport');">
4. add the webtrends script in the head (note: should be provided by the client or find it).
<script type="text/javascript" src="http://test.com/assets/js/TBv3.08.6.2webtrends.js"></script>
Wednesday, 31 August 2011
Facebook Share button within Facebook
1.Create a javascript function:
function sharePost() {
FB.ui(
{
method: 'stream.publish',
attachment: {
name: 'test',
media:[{type:'image',src:'logo.jpg',href: 'www.facebook.com/test'}],
description: ('Test.' ),
href: 'http://www.facebook.com/pages/test/11111111?sk=app_111111111'
}
});
return false;
}
2. Add click event to the a tag.
<a href="#" onclick="sharePost(); return false;" >button</a>
3. Add facebook init.
<div id="fb-root"></div>
<script>
window.fbAsyncInit = function() {
FB.init({appId: "11111111",
status: true,
cookie: true,
xfbml: true});
FB.Canvas.setSize({width: 520, height: 1200});
};
(function() {
var e = document.createElement('script'); e.async = true;
e.src = document.location.protocol +
'//connect.facebook.net/en_US/all.js';
document.getElementById('fb-root').appendChild(e);
}());
</script>
3. Add facebook init.
<div id="fb-root"></div>
<script>
window.fbAsyncInit = function() {
FB.init({appId: "11111111",
status: true,
cookie: true,
xfbml: true});
FB.Canvas.setSize({width: 520, height: 1200});
};
(function() {
var e = document.createElement('script'); e.async = true;
e.src = document.location.protocol +
'//connect.facebook.net/en_US/all.js';
document.getElementById('fb-root').appendChild(e);
}());
</script>
Saturday, 27 August 2011
Github commit
cd js3
when you commit on your local repo?
always start with git status
then git add .
then git commit . -m "message goes here"
then to push to the remote github
git push origin master
basically you just push the entire repo's changes to github
JS3 - Drag Objects
Working on improving: not working currently.
Example:
Code:
sprite.addEventListener(MouseEvent.MOUSE_DOWN,onDown);
sprite.addEventListener(MouseEvent.MOUSE_UP,onUp);
function onDown()
{
sprite.startDrag();
}
function onUp()
{
sprite.stopDrag();
}
Example:
Code:
sprite.addEventListener(MouseEvent.MOUSE_DOWN,onDown);
sprite.addEventListener(MouseEvent.MOUSE_UP,onUp);
function onDown()
{
sprite.startDrag();
}
function onUp()
{
sprite.stopDrag();
}
JS3 - Motion Tween
Example:
Code:
var t1;
t1 = new Tween(sprite,'alpha',Tween.elasticEaseOut,1,0,4,onTweenComplete);
t1.start();
function onTweenComplete()
{
sprite.alpha(1);
t1 = new Tween(sprite,'x',Tween.elasticEaseOut,0,100,4,onTweenComplete);
t1.start();
}
Code:
var t1;
t1 = new Tween(sprite,'alpha',Tween.elasticEaseOut,1,0,4,onTweenComplete);
t1.start();
function onTweenComplete()
{
sprite.alpha(1);
t1 = new Tween(sprite,'x',Tween.elasticEaseOut,0,100,4,onTweenComplete);
t1.start();
}
Friday, 26 August 2011
JS3 - Debugger (Console Window)
To invoke the console window, execute the debug() function and your traces will appear in the console window.
console.debug();
trace("hello");
trace("hello");
trace("hello");
trace("hello");
trace("hello");
trace("hello");
trace("hello");
trace("hello");
trace("hello");
trace("hello");
JS3 - Create A Sprite
Framework updated: not working on this older version.
Example:
Code:
var sprite = new Sprite();
sprite.lineStyle(3,"0x00ff00");
sprite.beginFill("0x0000FF",0);
sprite.drawRect(10,10,100,100);
sprite.endFill();
addChild(sprite);
Example:
Code:
var sprite = new Sprite();
sprite.lineStyle(3,"0x00ff00");
sprite.beginFill("0x0000FF",0);
sprite.drawRect(10,10,100,100);
sprite.endFill();
addChild(sprite);
JS3 - Create A Movieclip
Framework updated: not working on this older version.
Example:
Code:
var clip = new MovieClip();
clip.name="movieclip";
clip.styleName="movieclip";
clip.src="images/walking2.png";
clip.setFrameRate(50);
clip.build();
clip.setWidth(195);
clip.setStyle();
clip.gotoAndPlay(0);
clip.x(0);
clip.y(0);
addChild(clip);
Example:
Code:
var clip = new MovieClip();
clip.name="movieclip";
clip.styleName="movieclip";
clip.src="images/walking2.png";
clip.setFrameRate(50);
clip.build();
clip.setWidth(195);
clip.setStyle();
clip.gotoAndPlay(0);
clip.x(0);
clip.y(0);
addChild(clip);
JS3 : Create Timer
var timer =new Timer(1000,1);
timer.addEventListener(TimerEvent.TIMER_COMPLETE,onTimer);
timer.start();
function onTimer()
{
trace("COMPLETE");
}
Sunday, 21 August 2011
OOP Javascript
creating a class with inheritable properties and accessing them.
var A = function(){}; // This is the constructor of "A"
A.prototype.constructor = A;
A.prototype.value = 1;
A.prototype.test = function() { alert(this.value); }
var a = new A(); // create an instance of A
alert(a.value); // => 1
alert(a.test()); // => 1
http://www.ruzee.com/blog/2008/12/javascript-inheritance-via-prototypes-and-closures
var A = function(){}; // This is the constructor of "A"
A.prototype.constructor = A;
A.prototype.value = 1;
A.prototype.test = function() { alert(this.value); }
var a = new A(); // create an instance of A
alert(a.value); // => 1
alert(a.test()); // => 1
http://www.ruzee.com/blog/2008/12/javascript-inheritance-via-prototypes-and-closures
Tuesday, 16 August 2011
Add Facebook share button (popup)
In order to make a shared button popup instead of it opening in a popup window you need to replace you 'a' tag with the follow:
<script>function fbs_click() {u=location.href;t=document.title;window.open('http://www.facebook.com/sharer.php?u=http:www.jiggyape.com','sharer','toolbar=0,status=0,width=626,height=436');return false;}</script><a rel="nofollow" href="http://www.facebook.com/share.php?u=<;url>" onclick="return fbs_click()" target="_blank">Share on Facebook</a>
replace the url after 'u=' with the url you want to share:
u=http:www.jiggyape.com'
Subscribe to:
Posts (Atom)