-
Button Fade-in issue repost with proper code formatting
Flash CS4
AS2
PHP Code:
var resArray:Array = new Array();
/****************** Properties to adjust for TIPS BUTTON begins here *****************/
// text that should appear in the tip popup. Will accept html codes.
var tipText = "This is where the tip text goes.";
var cytText = "This is where Check your Thinking text goes.";
//This is how many seconds the icon will be invisible until it fades in and is clickable.
var needTechVideoBtn = true;
var secondsDelay_techVideo = 0;
var needTechTextBtn = true;
var secondsDelay_techText = 0;
var needTipBtn = true;
var secondsDelay = 1;
//select a teacher image to use
// teacherOne = African American Woman
// teacherTwo = Caucasian Male
// teacherThree = Asian Woman
tipTextObject.teacherImage.gotoAndPlay("teacherOne");
var needCytBtn = true;
var secondsDelay_cytBtn = 0;
//select a teacher image to use
// teacherOne = African American Woman
// teacherTwo = Caucasian Male
// teacherThree = Asian Woman
cytTextObject.teacherImage.gotoAndPlay("teacherTwo");
/****************** Properties to adjust for TIPS BUTTON ends here *****************/
/****************** Properties to adjust for RESOURCES/COMPONENT REFERENCES begin here *****************/
//Enter your resources here, maximum of 16 resources (counting 0, so your array should not have more than resArray[15]).
//Type is the type of resource (pdf, excel, word, audio, video, weblink)
//Name is how you want it to appear in the list
//Filesize is the bytesize of the document
//Link is the actual link to the document
var needResources = false;
resArray[0] = {Type:"pdf", Name:"test pdf", FileSize:"332KB", Link:"../../../resources/filename"};
resArray[1] = {Type:"excel", Name:"test excel", FileSize:"1.1MB", Link:"../../../resources/filename"};
resArray[2] = {Type:"word", Name:"test word", FileSize:"1.18MB", Link:"words.word"};
resArray[3] = {Type:"audio", Name:"test audio", FileSize:"1.18MB", Link:"words.word"};
resArray[4] = {Type:"video", Name:"test video", FileSize:"1.18MB", Link:"words.word"};
resArray[5] = {Type:"weblink", Name:"test web", FileSize:"1.18MB", Link:"words.word"};
/****************** Properties to adjust for RESOURCES/COMPONENT REFERENCES end here *****************/
/****************** Code that makes the TIPS BUTTON work begins here ******************/
//basics here
var ArtAPI = _level0.ArtAPI;
var wasPlaying = true;
this.onEnterFrame = function () {
_level33._xscale = _level22.mcSlideGroup._xscale;
_level33._yscale = _level22.mcSlideGroup._yscale;
_level33._x = _level22.mcSlideGroup._x;
_level33._y = _level22.mcSlideGroup._y;
}
this.onUnload = function () {
delete this.onEnterFrame;
}
//tips particular code here
/*
if (buttonPosition == "left") {
tipBtn._x = 24;
tipTextObject._x = 84;
} else {
tipBtn._x = 604;
tipTextObject._x = 35;
}*/
tipTitleFormat = new TextFormat();
tipTitleFormat.size = 14;
tipTitleFormat.font = "Gill Sans"
tipTitleFormat.color = 0xFFFFFF;
tipFormat = new TextFormat();
tipFormat.size = 14;
tipFormat.font = "Gill Sans"
tipFormat.color = 0x000000;
stop();
function removeTipBtn (){
if (needTipBtn == false) {
delete btnFadeIn_tip;
delete myInterval_tip;
delete tipBtn;
}
}
removeTipBtn();
tipTextObject._visible = false;
tipBtn._visible = false;
tipTextObject.textTarget.setTextFormat(tipFormat);
tipTextObject.textTarget.embedFonts = true;
tipTextObject.textTarget.htmlText = tipText;
function btnFadeIn_tip (){
tipBtn._visible = true;
clearInterval(myInterval_tip);
//tipBtn.play();
}
var myInterval_tip = setInterval(btnFadeIn_tip,(secondsDelay * 1000));
tipBtn.onPress = function() {
if (ArtAPI.IsPlaying() == false && tipTextObject._visible == false) {
wasPlaying = false;
}
if (wasPlaying == true) {
if (tipTextObject._visible == false) {
ArtAPI.Pause();
tipTextObject._visible = true;
} else {
ArtAPI.Play();
tipTextObject._visible = false;
}
} else {
if (tipTextObject._visible == false) {
tipTextObject._visible = true;
} else {
tipTextObject._visible = false;
}
}
}
tipTextObject.tipCloseBut.onRelease = function() {
if (wasPlaying == true) {
tipTextObject._visible = false;
ArtAPI.Play();
} else {
tipTextObject._visible = false;
}
}
/****************** Code that makes the CYT BUTTON work begins here ******************/
cytTitleFormat = new TextFormat();
cytTitleFormat.size = 14;
cytTitleFormat.font = "Gill Sans"
cytTitleFormat.color = 0xFFFFFF;
cytFormat = new TextFormat();
cytFormat.size = 14;
cytFormat.font = "Gill Sans"
cytFormat.color = 0x000000;
stop();
function removeCytBtn (){
if (needCytBtn == false) {
delete btnFadeIn_cyt;
delete myInterval_cyt;
delete cytBtn;
}
}
removeCytBtn();
cytTextObject._visible = false;
cytBtn._visible = false;
cytTextObject.textTarget.setTextFormat(cytFormat);
cytTextObject.textTarget.embedFonts = true;
cytTextObject.textTarget.htmlText = cytText;
function btnFadeIn_cyt (){
cytBtn._visible = true;
clearInterval(myInterval_cyt);
//CytBtn.play();
}
var myInterval_cyt = setInterval(btnFadeIn_cyt,(secondsDelay * 1000));
cytBtn.onPress = function() {
if (ArtAPI.IsPlaying() == false && cytTextObject._visible == false) {
wasPlaying = false;
}
if (wasPlaying == true) {
if (cytTextObject._visible == false) {
ArtAPI.Pause();
cytTextObject._visible = true;
} else {
ArtAPI.Play();
cytTextObject._visible = false;
}
} else {
if (cytTextObject._visible == false) {
cytTextObject._visible = true;
} else {
cytTextObject._visible = false;
}
}
}
cytTextObject.cytCloseBut.onRelease = function() {
if (wasPlaying == true) {
cytTextObject._visible = false;
ArtAPI.Play();
} else {
cytTextObject._visible = false;
}
}
/*End CYT Button------------------------------*/
function removeTechVideoBtn (){
if (needTechVideoBtn == false) {
delete btnFadeIn_techVideo;
delete myInterval_techVideo;
delete techVideoBtn;
}
}
removeTechVideoBtn();
techVideoBtn._visible = false;
function btnFadeIn_techVideo (){
techVideoBtn._visible = true;
clearInterval(myInterval_techVideo);
//tipBtn.play();
}
var myInterval_techVideo = setInterval(btnFadeIn_techVideo,(secondsDelay_techVideo * 1000));
techVideoBtn.onRelease = function() {
ArtAPI.Pause();
getURL ("javascript:NewWindow=window.open('../../../videos/digitalLesson.html','newWin','width=640,height=365,left=0,top=0, toolbar=No,location=No,scrollbars=Yes,status=No,resizable=Yes,fullscreen=No'); NewWindow.focus(); void(0);");
}
function removeTechTextBtn (){
if (needTechTextBtn == false) {
delete btnFadeIn_techText;
delete myInterval_techText;
delete techTextBtn;
}
}
removeTechTextBtn();
techTextBtn._visible = false;
function btnFadeIn_techText (){
techTextBtn._visible = true;
clearInterval(myInterval_techText);
//tipBtn.play();
}
var myInterval_techText = setInterval(btnFadeIn_techText,(secondsDelay_techText * 1000));
techTextBtn.onRelease = function() {
ArtAPI.Pause();
getURL ("javascript:NewWindow=window.open('./demoCap_resize/demoCapture.htm','newWin','width=824,height=542,left=0,top=0, toolbar=No,location=No,scrollbars=Yes,status=No,resizable=Yes,fullscreen=No'); NewWindow.focus(); void(0);");
}
// **************** Code that makes the TIPS BUTTON work ends here ***************** //
// **************** Code that makes the RESOURCES/COMPONENT REFERENCES work begins here **************** //
function removeResources (){
if (needResources == false) {
resReminder.gotoAndStop("_init");
_global.hasResource = false;
}
}
removeResources();
regTextFormat = new TextFormat();
regTextFormat.size = 14;
regTextFormat.underline = false;
regTextFormat.font = "Gill Sans"
regTextFormat.color = 0x6F6F6F;
overTextFormat = new TextFormat();
overTextFormat.size = 14;
overTextFormat.underline = true;
overTextFormat.font = "Gill Sans"
overTextFormat.color = 0x2B85C5;
var ArtAPI = _level0.ArtAPI;
for (i=0; i<6; i++) {
resourceMenuSmall.contentHolder["resource" + i]._visible = false;
}
for (i=0; i<16; i++) {
resourceMenuBig.contentHolder["resource" + i]._visible = false;
}
resourceMenuBig.contentHolder.closeBut.onRelease = function() {
resourceMenuBig.gotoAndPlay("_close");
ArtAPI.Play();
}
resourceMenuSmall.contentHolder.closeBut.onRelease = function() {
resourceMenuSmall.gotoAndPlay("_close");
ArtAPI.Play();
}
resReminder.onRelease = function() {
if (resReminder._currentframe > 1 && resReminder._currentframe < 111) {
resReminder.gotoAndPlay("_close");
}
_global.resourcePressed = true;
}
if (resArray.length > 6) {
buildResPanel(resourceMenuBig);
} else {
buildResPanel(resourceMenuSmall);
}
function openReminder() {
resReminder.gotoAndPlay("_open");
}
function closeReminder() {
resReminder.gotoAndPlay("_close");
}
function buildResPanel(panelSize) {
resourceMenuSmall.gotoAndStop("_init");
resourceMenuBig.gotoAndStop("_init");
for (i=0; i<resArray.length; i++) {
panelSize.contentHolder["resource" + i]._visible = true;
panelSize.contentHolder["resource" + i].resText.htmlText = resArray[i].Name + " (" + resArray[i].FileSize + ")";
panelSize.contentHolder["resource" + i].resText.setTextFormat(regTextFormat);
panelSize.contentHolder["resource" + i].resText.embedFonts = true;
panelSize.contentHolder["resource" + i].resText.multiline = true;
panelSize.contentHolder["resource" + i].resText.wordWrap = true;
panelSize.contentHolder["resource" + i].resText.autoSize = "left";
panelSize.contentHolder["resource" + i].onRelease = function() {
getURL(resArray[int(substring(String(this._name), 9 , 1000))].Link,"_blank");
}
panelSize.contentHolder["resource" + i].onRollOver = function() {
this.resText.setTextFormat(overTextFormat);
this.resText.embedFonts = true;
}
panelSize.contentHolder["resource" + i].onRollOut = function() {
this.resText.setTextFormat(regTextFormat);
this.resText.embedFonts = true;
}
switch (resArray[i].Type) {
case "pdf" :
panelSize.contentHolder["resource" + i].docIcons.gotoAndPlay("_pdf");
break;
case "excel" :
panelSize.contentHolder["resource" + i].docIcons.gotoAndPlay("_excel");
break;
case "word" :
panelSize.contentHolder["resource" + i].docIcons.gotoAndPlay("_word");
break;
case "audio" :
panelSize.contentHolder["resource" + i].docIcons.gotoAndPlay("_audio");
break;
case "video" :
panelSize.contentHolder["resource" + i].docIcons.gotoAndPlay("_video");
break;
case "weblink" :
panelSize.contentHolder["resource" + i].docIcons.gotoAndPlay("_weblink");
break;
}
}
}
this.onEnterFrame = function () {
_level33._xscale = _level22.mcSlideGroup._xscale;
_level33._yscale = _level22.mcSlideGroup._yscale;
_level33._x = _level22.mcSlideGroup._x;
_level33._y = _level22.mcSlideGroup._y;
if (needResources == true) {
_global.hasResource = true;
}
if (_global.resourcePressed == true) {
_global.resourcePressed = false;
ArtAPI.Pause();
if (resArray.length > 6) {
resourceMenuBig.gotoAndPlay("_open");
} else {
resourceMenuSmall.gotoAndPlay("_open");
}
if (resReminder._currentframe > 1 && resReminder._currentframe < 111) {
resReminder.gotoAndPlay("_close");
}
}
}
this.onUnload = function () {
delete this.onEnterFrame;
}
_global.resourceOnSlide = ArtAPI.GetCurrentSlide();
stop();
-
The delete function is there so we can drop buttons that we want to delete and save the file under a specific name with only the button(s) available that we want. The fade in function is so any button we want in the file will appear at a particular point in an audio narrative. This is a master template to be used in generating many specific usage files.
----------------------------------------------------
Basically the needBtn function will determine if that button is visible/deleted or not. True or false makes the determination
Example:
var needTipBtn = true;
var secondsDelay = 1;
It will be visible in this case.
var needTipBtn = false;
var secondsDelay = 1;
It won't be visible.
----------------------------------------------------
This code makes the true/false choice work -
function removeTipBtn (){
if (needTipBtn == false) {
delete btnFadeIn_tip;
delete myInterval_tip;
delete tipBtn;
}
}
removeTipBtn();
tipTextObject._visible = false;
tipBtn._visible = false;
tipTextObject.textTarget.setTextFormat(tipFormat);
tipTextObject.textTarget.embedFonts = true;
tipTextObject.textTarget.htmlText = tipText;
function btnFadeIn_tip (){
tipBtn._visible = true;
clearInterval(myInterval_tip);
}
var myInterval_tip = setInterval(btnFadeIn_tip,(secondsDelay * 1000));
----------------------------------------------------
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|