Skip to content

Instantly share code, notes, and snippets.

@fallenartist
Created May 12, 2015 23:52
Show Gist options
  • Save fallenartist/36a9dfb017fb52844bfc to your computer and use it in GitHub Desktop.
Save fallenartist/36a9dfb017fb52844bfc to your computer and use it in GitHub Desktop.
Code used in CC4G online invitation. More about the project: https://www.behance.net/gallery/26152353/CC4G-Invitation
//----------------------------------------------------------------------
//Instance of Symbol 46 MovieClip "btn_card_1" in Frame 3
//----------------------------------------------------------------------
onClipEvent (load) {
function giveScale(num) {
targetXscale = num;
targetYscale = num;
}
function givePos(numX, numY) {
targetXpos = numX;
targetYpos = numY;
}
function giveAlpha(numA) {
targetAlpha = numA;
}
targetXscale = this._xscale;
targetYscale = this._yscale;
Sspeed = 2;
targetXpos = this._x;
targetYpos = this._y;
Pspeed = 5;
targetAlpha = this._alpha;
Aspeed = 3;
}
onClipEvent (enterFrame) {
oldXscale = this._xscale;
oldYscale = this._yscale;
this._xscale = this._xscale + ((targetXscale - oldXscale) / Sspeed);
this._yscale = this._yscale + ((targetYscale - oldYscale) / Sspeed);
oldXpos = this._x;
oldYpos = this._y;
this._x = this._x + ((targetXpos - oldXpos) / Pspeed);
this._y = this._y + ((targetYpos - oldYpos) / Pspeed);
oldAlpha = this._alpha;
this._alpha = this._alpha + ((targetAlpha - oldAlpha) / Aspeed);
}
//----------------------------------------------------------------------
//Frame 2
//----------------------------------------------------------------------
if (this._framesloaded < this._totalframes) {
this.gotoAndPlay(1);
} else {
this.gotoAndStop(3);
}
//----------------------------------------------------------------------
//Instance of Symbol 37 MovieClip "btn_card_3" in Frame 3
//----------------------------------------------------------------------
onClipEvent (load) {
function giveScale(num) {
targetXscale = num;
targetYscale = num;
}
function givePos(numX, numY) {
targetXpos = numX;
targetYpos = numY;
}
function giveAlpha(numA) {
targetAlpha = numA;
}
targetXscale = this._xscale;
targetYscale = this._yscale;
Sspeed = 2;
targetXpos = this._x;
targetYpos = this._y;
Pspeed = 5;
targetAlpha = this._alpha;
Aspeed = 3;
}
onClipEvent (enterFrame) {
oldXscale = this._xscale;
oldYscale = this._yscale;
this._xscale = this._xscale + ((targetXscale - oldXscale) / Sspeed);
this._yscale = this._yscale + ((targetYscale - oldYscale) / Sspeed);
oldXpos = this._x;
oldYpos = this._y;
this._x = this._x + ((targetXpos - oldXpos) / Pspeed);
this._y = this._y + ((targetYpos - oldYpos) / Pspeed);
oldAlpha = this._alpha;
this._alpha = this._alpha + ((targetAlpha - oldAlpha) / Aspeed);
}
//----------------------------------------------------------------------
//Symbol 25 MovieClip Frame 1
//----------------------------------------------------------------------
k = new Object();
k.onKeyUp = function () {
if ((field_friend.text != "") && (field_email.text != "")) {
form_send.btn_form_send.enabled = true;
} else {
form_send.btn_form_send.enabled = false;
}
};
Key.addListener(k);
form_send.btn_form_send.enabled = false;
field_friend.onSetFocus = function (oldFocus) {
hint_friend.text = "";
};
field_email.onSetFocus = function (oldFocus) {
hint_email.text = "";
};
//----------------------------------------------------------------------
//Frame 7
//----------------------------------------------------------------------
stop();
btn_card_5.enabled = true;
url_staff._visible = true;
url_staff.onRollOver = function () {
btn_card_5.giveScale(105);
url_staff.gotoAndStop(2);
};
url_staff.onRollOut = function () {
url_staff.gotoAndStop(1);
};
url_staff.onPress = function () {
getURL ("http://www.e-skills.com/staffroom", "_blank");
};
btn_card_5.onRollOver = function () {
this.giveScale(105);
};
btn_card_5.onRollOut = function () {
this.giveScale(100);
};
btn_card_5.onPress = function () {
this.giveScale(120);
this.giveAlpha(0);
this.onEnterFrame = function () {
if (this._alpha <= 0) {
this._visible = false;
url_staff._visible = false;
gotoAndStop (8);
}
};
};
//----------------------------------------------------------------------
//Frame 5
//----------------------------------------------------------------------
stop();
btn_card_3.enabled = true;
btn_card_3.onRollOver = function () {
this.giveScale(105);
};
btn_card_3.onRollOut = function () {
this.giveScale(100);
};
btn_card_3.onPress = function () {
this.giveScale(120);
this.giveAlpha(0);
this.onEnterFrame = function () {
if (this._alpha <= 0) {
this._visible = false;
gotoAndStop (6);
}
};
};
//----------------------------------------------------------------------
//Instance of Symbol 11 MovieClip "btn_share" in Frame 3
//----------------------------------------------------------------------
onClipEvent (load) {
function giveScale(num) {
targetXscale = num;
targetYscale = num;
}
function givePos(numX, numY) {
targetXpos = numX;
targetYpos = numY;
}
function giveAlpha(numA) {
targetAlpha = numA;
}
targetXscale = this._xscale;
targetYscale = this._yscale;
Sspeed = 2;
targetXpos = this._x;
targetYpos = this._y;
Pspeed = 5;
targetAlpha = this._alpha;
Aspeed = 3;
}
onClipEvent (enterFrame) {
oldXscale = this._xscale;
oldYscale = this._yscale;
this._xscale = this._xscale + ((targetXscale - oldXscale) / Sspeed);
this._yscale = this._yscale + ((targetYscale - oldYscale) / Sspeed);
oldXpos = this._x;
oldYpos = this._y;
this._x = this._x + ((targetXpos - oldXpos) / Pspeed);
this._y = this._y + ((targetYpos - oldYpos) / Pspeed);
oldAlpha = this._alpha;
this._alpha = this._alpha + ((targetAlpha - oldAlpha) / Aspeed);
}
//----------------------------------------------------------------------
//Instance of Symbol 25 MovieClip "share_form" in Frame 3
//----------------------------------------------------------------------
onClipEvent (load) {
function giveScale(num) {
targetXscale = num;
targetYscale = num;
}
function givePos(numX, numY) {
targetXpos = numX;
targetYpos = numY;
}
function giveAlpha(numA) {
targetAlpha = numA;
}
targetXscale = this._xscale;
targetYscale = this._yscale;
Sspeed = 2;
targetXpos = this._x;
targetYpos = this._y;
Pspeed = 5;
targetAlpha = this._alpha;
Aspeed = 3;
}
onClipEvent (enterFrame) {
oldXscale = this._xscale;
oldYscale = this._yscale;
this._xscale = this._xscale + ((targetXscale - oldXscale) / Sspeed);
this._yscale = this._yscale + ((targetYscale - oldYscale) / Sspeed);
oldXpos = this._x;
oldYpos = this._y;
this._x = this._x + ((targetXpos - oldXpos) / Pspeed);
this._y = this._y + ((targetYpos - oldYpos) / Pspeed);
oldAlpha = this._alpha;
this._alpha = this._alpha + ((targetAlpha - oldAlpha) / Aspeed);
}
//----------------------------------------------------------------------
//Symbol 19 MovieClip Frame 2
//----------------------------------------------------------------------
function delay() {
clearInterval(intID);
_root.btn_share._visible = true;
_root.share_form.giveAlpha(0);
_root.share_form.giveScale(25);
_root.share_form.onEnterFrame = function () {
if (this._alpha <= 0) {
this._visible = false;
gotoAndStop (1);
}
};
}
var intID;
intID = setInterval(delay, 3000);
//----------------------------------------------------------------------
//Instance of Symbol 19 MovieClip "form_send" in Symbol 25 MovieClip Frame 1
//----------------------------------------------------------------------
onClipEvent (load) {
function giveScale(num) {
targetXscale = num;
targetYscale = num;
}
targetXscale = this._xscale;
targetYscale = this._yscale;
Sspeed = 2;
}
onClipEvent (enterFrame) {
oldXscale = this._xscale;
oldYscale = this._yscale;
this._xscale = this._xscale + ((targetXscale - oldXscale) / Sspeed);
this._yscale = this._yscale + ((targetYscale - oldYscale) / Sspeed);
}
//----------------------------------------------------------------------
//Symbol 49 MovieClip Frame 1
//----------------------------------------------------------------------
stop();
//----------------------------------------------------------------------
//Symbol 19 MovieClip Frame 1
//----------------------------------------------------------------------
stop();
//----------------------------------------------------------------------
//Symbol 18 Button
//----------------------------------------------------------------------
on (release) {
php_friend_name = _parent.field_friend.text;
php_friend_email = _parent.field_email.text;
loadVariables ("sendemail.php", this, "POST");
this.onData = function () {
if (this.output == "sent") {
_parent.confirm_text.text = "Message sent!";
getURL ("javascript:pageTracker._trackPageview('/invite/email_sent.html');");
gotoAndStop (2);
} else {
_parent.confirm_text.text = "Error! Please try again later";
gotoAndStop (2);
}
};
}
//----------------------------------------------------------------------
//Frame 6
//----------------------------------------------------------------------
stop();
btn_card_4.enabled = true;
btn_card_4.onRollOver = function () {
this.giveScale(105);
};
btn_card_4.onRollOut = function () {
this.giveScale(100);
};
btn_card_4.onPress = function () {
this.giveScale(120);
this.giveAlpha(0);
this.onEnterFrame = function () {
if (this._alpha <= 0) {
this._visible = false;
gotoAndStop (7);
}
};
};
//----------------------------------------------------------------------
//Instance of Symbol 28 MovieClip "btn_card_5" in Frame 3
//----------------------------------------------------------------------
onClipEvent (load) {
function giveScale(num) {
targetXscale = num;
targetYscale = num;
}
function givePos(numX, numY) {
targetXpos = numX;
targetYpos = numY;
}
function giveAlpha(numA) {
targetAlpha = numA;
}
targetXscale = this._xscale;
targetYscale = this._yscale;
Sspeed = 2;
targetXpos = this._x;
targetYpos = this._y;
Pspeed = 5;
targetAlpha = this._alpha;
Aspeed = 3;
}
onClipEvent (enterFrame) {
oldXscale = this._xscale;
oldYscale = this._yscale;
this._xscale = this._xscale + ((targetXscale - oldXscale) / Sspeed);
this._yscale = this._yscale + ((targetYscale - oldYscale) / Sspeed);
oldXpos = this._x;
oldYpos = this._y;
this._x = this._x + ((targetXpos - oldXpos) / Pspeed);
this._y = this._y + ((targetYpos - oldYpos) / Pspeed);
oldAlpha = this._alpha;
this._alpha = this._alpha + ((targetAlpha - oldAlpha) / Aspeed);
}
//----------------------------------------------------------------------
//Instance of Symbol 34 MovieClip "btn_card_4" in Frame 3
//----------------------------------------------------------------------
onClipEvent (load) {
function giveScale(num) {
targetXscale = num;
targetYscale = num;
}
function givePos(numX, numY) {
targetXpos = numX;
targetYpos = numY;
}
function giveAlpha(numA) {
targetAlpha = numA;
}
targetXscale = this._xscale;
targetYscale = this._yscale;
Sspeed = 2;
targetXpos = this._x;
targetYpos = this._y;
Pspeed = 5;
targetAlpha = this._alpha;
Aspeed = 3;
}
onClipEvent (enterFrame) {
oldXscale = this._xscale;
oldYscale = this._yscale;
this._xscale = this._xscale + ((targetXscale - oldXscale) / Sspeed);
this._yscale = this._yscale + ((targetYscale - oldYscale) / Sspeed);
oldXpos = this._x;
oldYpos = this._y;
this._x = this._x + ((targetXpos - oldXpos) / Pspeed);
this._y = this._y + ((targetYpos - oldYpos) / Pspeed);
oldAlpha = this._alpha;
this._alpha = this._alpha + ((targetAlpha - oldAlpha) / Aspeed);
}
//----------------------------------------------------------------------
//Instance of Symbol 53 MovieClip "yyy" in Frame 8
//----------------------------------------------------------------------
onClipEvent (load) {
function giveScale(num) {
targetXscale = num;
targetYscale = num;
}
targetXscale = this._xscale;
targetYscale = this._yscale;
Sspeed = 3;
}
onClipEvent (enterFrame) {
oldXscale = this._xscale;
oldYscale = this._yscale;
this._xscale = this._xscale + ((targetXscale - oldXscale) / Sspeed);
this._yscale = this._yscale + ((targetYscale - oldYscale) / Sspeed);
}
//----------------------------------------------------------------------
//Frame 3
//----------------------------------------------------------------------
stop();
btn_card_1._visible = true;
btn_card_1.enabled = true;
btn_card_1.giveAlpha(100);
btn_card_1.giveScale(100);
btn_card_1.onEnterFrame = function () {
if ((this._alpha = 100)) {
btn_card_2._visible = true;
btn_card_2.giveAlpha(100);
btn_card_2.giveScale(100);
btn_card_2.enabled = false;
}
};
btn_card_2.onEnterFrame = function () {
if ((this._alpha = 100)) {
btn_card_3._visible = true;
btn_card_3.giveAlpha(100);
btn_card_3.giveScale(100);
btn_card_3.enabled = false;
}
};
btn_card_3.onEnterFrame = function () {
if ((btn_card_3._alpha = 100)) {
btn_card_4._visible = true;
btn_card_4.giveAlpha(100);
btn_card_4.giveScale(100);
btn_card_4.enabled = false;
}
};
btn_card_4.onEnterFrame = function () {
if ((this._alpha = 100)) {
btn_card_5._visible = true;
btn_card_5.giveAlpha(100);
btn_card_5.giveScale(100);
btn_card_5.enabled = false;
}
};
btn_share._visible = true;
btn_share.enabled = false;
share_form._visible = false;
url_cc4g._visible = false;
url_staff._visible = false;
btn_card_1.onRollOver = function () {
this.giveScale(105);
};
btn_card_1.onRollOut = function () {
this.giveScale(100);
};
btn_card_1.onPress = function () {
this.giveScale(120);
this.giveAlpha(0);
this.onEnterFrame = function () {
if (this._alpha <= 0) {
this._visible = false;
gotoAndStop (4);
}
};
};
//----------------------------------------------------------------------
//Frame 8
//----------------------------------------------------------------------
stop();
btn_share.enabled = true;
xx.onRollOver = function () {
this.giveScale(110);
};
xx.onRollOut = function () {
this.giveScale(100);
};
btn_replay.onPress = function () {
share_form.giveAlpha(0);
share_form.giveScale(25);
gotoAndStop (3);
};
btn_share.onRollOver = function () {
this.giveScale(115);
};
btn_share.onRollOut = function () {
this.giveScale(100);
};
btn_share.onPress = function () {
this.giveScale(100);
this._visible = false;
share_form.giveAlpha(100);
share_form.giveScale(100);
share_form._visible = true;
share_form.form_send.btn_form_send.enabled = false;
share_form.field_friend.text = "";
share_form.field_email.text = "";
share_form.hint_friend.text = "Your Friend's Name";
share_form.hint_email.text = "Your Friend's Email";
share_form.confirm_text.text = "Share the news with a Friend!";
};
//----------------------------------------------------------------------
//Symbol 51 MovieClip Frame 1
//----------------------------------------------------------------------
stop();
//----------------------------------------------------------------------
//Frame 1
//----------------------------------------------------------------------
var pctLoaded = Math.round((this.getBytesLoaded() / this.getBytesTotal()) * 100);
loadingBar._xscale = pctLoaded;
//----------------------------------------------------------------------
//Instance of Symbol 43 MovieClip "btn_card_2" in Frame 3
//----------------------------------------------------------------------
onClipEvent (load) {
function giveScale(num) {
targetXscale = num;
targetYscale = num;
}
function givePos(numX, numY) {
targetXpos = numX;
targetYpos = numY;
}
function giveAlpha(numA) {
targetAlpha = numA;
}
targetXscale = this._xscale;
targetYscale = this._yscale;
Sspeed = 2;
targetXpos = this._x;
targetYpos = this._y;
Pspeed = 5;
targetAlpha = this._alpha;
Aspeed = 3;
}
onClipEvent (enterFrame) {
oldXscale = this._xscale;
oldYscale = this._yscale;
this._xscale = this._xscale + ((targetXscale - oldXscale) / Sspeed);
this._yscale = this._yscale + ((targetYscale - oldYscale) / Sspeed);
oldXpos = this._x;
oldYpos = this._y;
this._x = this._x + ((targetXpos - oldXpos) / Pspeed);
this._y = this._y + ((targetYpos - oldYpos) / Pspeed);
oldAlpha = this._alpha;
this._alpha = this._alpha + ((targetAlpha - oldAlpha) / Aspeed);
}
//----------------------------------------------------------------------
//Frame 4
//----------------------------------------------------------------------
stop();
btn_card_2.enabled = true;
url_cc4g._visible = true;
url_cc4g.onRollOver = function () {
btn_card_2.giveScale(105);
url_cc4g.gotoAndStop(2);
};
url_cc4g.onRollOut = function () {
url_cc4g.gotoAndStop(1);
};
url_cc4g.onPress = function () {
getURL ("http://www.cc4g.net", "_blank");
};
btn_card_2.onRollOver = function () {
this.giveScale(105);
};
btn_card_2.onRollOut = function () {
this.giveScale(100);
};
btn_card_2.onPress = function () {
this.giveScale(120);
this.giveAlpha(0);
this.onEnterFrame = function () {
if (this._alpha <= 0) {
this._visible = false;
url_cc4g._visible = false;
gotoAndStop (5);
}
};
};
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title>CC4G</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
try {
var pageTracker = _gat._getTracker("UA-xxxxxxx-x");
pageTracker._trackPageview();
} catch(err) {}
</script>
<script type="text/javascript" src="js/swfobject.js"></script>
<script type="text/javascript">
var flashvars = {};
var params = {};
params.menu = "false";
params.quality = "high";
var attributes = {};
swfobject.embedSWF("CC4G.swf", "altContent", "900", "600", "8.0.0", "expressInstall.swf", flashvars, params, attributes);
</script>
</head>
<body bgcolor="#514c49" text="#ffffff" style="text-align:center">
<div id="altContent" align="center">
<a href="http://www.adobe.com/go/getflashplayer">
<img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Flash player in order to see the content" />
<p style="font-family: Arial, Helvetica, sans-serif; color: #ffffff">Please install Flash Player plugin to see the content!</p>
</a>
</div>
</body>
</html>
<?php
include_once('php/class.phpmailer.php');
if(!empty($_POST['php_friend_name']) || !empty($_POST['php_friend_email']))
{
$mail = new PHPMailer(); // defaults to using php "mail()"
$body = $mail->getFile('email.html');
$body = eregi_replace("[\]",'',$body);
$mail->From = "noreply@e-skills.com";
$mail->FromName = "e-skills Staffroom";
$f_email = $_POST['php_friend_email']; // friend's mail address
$f_name = stripslashes($_POST['php_friend_name']);
$mail->AddAddress($f_email, $f_name);
$mail->Subject = "$f_name, check out the new CC4G";
$mail->AltBody = "To view the message, please use an HTML compatible email viewer or go directly to http://www.cc4g.net/launch"; // optional
$mail->MsgHTML($body);
// send
if(!$mail->Send()) {
echo "output=error";
} else {
echo "output=sent";
}
} else {
echo "output=error";
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment