SWFAddress 2.2 isn't responding to specific URLs - actionscript-2

I am implementing SWFAddress into a Flash movie, and while my navigation is setting the links correctly, when I type in a specific URL, it doesn't seem to communicate with the browser at all. Am I missing a listener or something?
http://client.deicreative.com/test/TBB/
This class talks to my navigation class:
import SWFAddress.as;
class code.RunSWFAddress {
public function RunSWFAddress(){
init();
}
private function init() {
var scope = this;
SWFAddress.setStrict(false);
SWFAddress.onChange = function() {
var value = SWFAddress.getValue();
var path = SWFAddress.getPath();
var id = SWFAddress.getParameter('id');
if (code.PageContent.getInstance().xmlVar1.getBytesLoaded() == code.PageContent.getInstance().xmlVar1.getBytesTotal()){
if(SWFAddress.getValue() == '/' || SWFAddress.getValue() == '') {
code.Navigation.getInstance().showPage(0);
} else {
for(var i:Number = 0; i<code.Startup.getInstance().numPages; i++){
if(SWFAddress.getValue() == code.Startup.getInstance().page_arr[i][0]){
code.Navigation.getInstance().showPage(i);
}
}
}
}
var title = 'The Broadway Building';
var names = SWFAddress.getPathNames();
for (var i = 0; i < names.length; i++) {
title += ' | ' + names[i].substr(0,1).toUpperCase() + names[i].substr(1);
}
var id = SWFAddress.getParameter('id');
if (id != '') {
title += ' | ' + id;
}
SWFAddress.setTitle(title);
}
}
}

I was missing the id attribute in my swfobject embed. Works now! :)

Related

managed c++ classes crash in create_task

Basically, what is happening is when trying to change a variable of a Managed class (UWP), it crashes. Additionally, it seems to only crash if I try modifying a variable which is created with the app namespace. In other words, if I create a new namspace and managed class, I can modify variables just fine.
void ASynTaskCategories(void)
{
concurrency::task_completion_event<Platform::String^> taskDone;
MainPage^ rootPage = this;
UberSnip::HELPER::ASYNC_RESPONSE^ responseItem = ref new UberSnip::HELPER::ASYNC_RESPONSE();
create_task([taskDone, responseItem, rootPage]() -> Platform::String^
{
//UBERSNIP API 0.4
UberSnip::UBERSNIP_CLIENT* UberSnipAPI = new UberSnip::UBERSNIP_CLIENT();
UberSnipAPI->Http->RequestURL = "http://api.ubersnip.com/categories.php";
UberSnipAPI->Http->request();
taskDone.set(UberSnipAPI->Client->BodyResponse);
responseItem->Body = UberSnipAPI->Client->BodyResponse;
return "(done)";
}).then([taskDone, responseItem, rootPage](Platform::String^ BodyResponse) {
Platform::String^ BR = responseItem->Body;
cJSON* cats = cJSON_Parse(_string(BR));
cats = cats->child;
int *cat_count = new int(cJSON_GetArraySize(cats));
rootPage->Categories->Clear();
GENERIC_ITEM^ all_item = ref new GENERIC_ITEM();
all_item->Title = "All";
rootPage->Categories->Append(all_item);
for (int i = 0; i < *cat_count; i++) {
cJSON* cat = new cJSON();
cat = cJSON_GetArrayItem(cats, i);
string *track_title = new string(cJSON_GetObjectItem(cat, "name")->valuestring);
GENERIC_ITEM gitem;
gitem.Title = "Hi";
GENERIC_ITEM^ ubersnipCategory = ref new GENERIC_ITEM();
ubersnipCategory->Title = _String(*track_title);
rootPage->Categories->Append(ubersnipCategory);
}
});
This does not crash
UberSnipAPI->Http->RequestURL = "http://api.ubersnip.com/categories.php";
but this one does
all_item->Title = "All";
I am almost positive it has something to do with it being in the apps default namespace and it being accessed outside of the main thread ... At least that's what it seems like as that's really the only difference besides the actual class.
This is what GENERIC_ITEM looks like.
[Windows::UI::Xaml::Data::Bindable]
public ref class GENERIC_ITEM sealed {
private:
Platform::String^ _title = "";
Platform::String^ _description;
Windows::UI::Xaml::Media::ImageSource^ _Image;
event PropertyChangedEventHandler^ _PropertyChanged;
void OnPropertyChanged(Platform::String^ propertyName)
{
PropertyChangedEventArgs^ pcea = ref new PropertyChangedEventArgs(propertyName);
_PropertyChanged(this, pcea);
}
public:
GENERIC_ITEM() {
};
property Platform::String^ Title {
Platform::String^ get() {
return this->_title;
}
void set(Platform::String^ val) {
this->_title = val;
OnPropertyChanged("Title");
}
}
property Platform::String^ Description {
Platform::String^ get() {
return this->_description;
}
void set(Platform::String^ val) {
this->_description = val;
OnPropertyChanged("Description");
}
}
void SetImage(Platform::String^ path)
{
Windows::Foundation::Uri^ uri = ref new Windows::Foundation::Uri(path);
_Image = ref new Windows::UI::Xaml::Media::Imaging::BitmapImage(uri);
}
};
I know there is no issue with the class because it works perfectly fine if I run this exact same code on the initial thread.
Any suggestions? Thanks! :D
Figured it out after several hours! In case someone else is having this issue, all you must do is use the Dispatcher to run code on the UI that is not available outside of the UI thread.
void loadCats(UberSnip::HELPER::ASYNC_RESPONSE^ responseItem, MainPage^ rootPage) {
Platform::String^ BR = responseItem->Body;
cJSON* cats = cJSON_Parse(_string(BR));
cats = cats->child;
int *cat_count = new int(cJSON_GetArraySize(cats));
rootPage->Categories->Clear();
GENERIC_ITEM^ all_item = ref new GENERIC_ITEM();
all_item->Title = "All";
rootPage->Categories->Append(all_item);
for (int i = 0; i < *cat_count; i++) {
cJSON* cat = new cJSON();
cat = cJSON_GetArrayItem(cats, i);
string *track_title = new string(cJSON_GetObjectItem(cat, "name")->valuestring);
GENERIC_ITEM gitem;
gitem.Title = "Hi";
GENERIC_ITEM^ ubersnipCategory = ref new GENERIC_ITEM();
ubersnipCategory->Title = _String(*track_title);
rootPage->Categories->Append(ubersnipCategory);
}
}
void ASyncTaskCategories(void)
{
concurrency::task_completion_event<Platform::String^> taskDone;
MainPage^ rootPage = this;
UberSnip::HELPER::ASYNC_RESPONSE^ responseItem = ref new UberSnip::HELPER::ASYNC_RESPONSE();
auto dispatch = CoreWindow::GetForCurrentThread()->Dispatcher;
auto op2 = create_async([taskDone, responseItem, rootPage, dispatch] {
return create_task([taskDone, responseItem, rootPage, dispatch]() -> Platform::String^
{
//UBERSNIP API 0.4
UberSnip::UBERSNIP_CLIENT* UberSnipAPI = new UberSnip::UBERSNIP_CLIENT();
UberSnipAPI->Http->RequestURL = "http://api.ubersnip.com/categories.php";
try{
UberSnipAPI->Http->request();
}
catch (...) {
printf("Error");
}
int err = UberSnip::UTILS::STRING::StringToAscIIChars(UberSnipAPI->Client->BodyResponse).find("__api_err");
if (err < 0) {
if (UberSnip::UTILS::STRING::StringToAscIIChars(UberSnipAPI->Client->BodyResponse).length() < 3) {
return;
}
}
taskDone.set(UberSnipAPI->Client->BodyResponse);
responseItem->Body = UberSnipAPI->Client->BodyResponse;
dispatch->RunAsync(Windows::UI::Core::CoreDispatcherPriority::High, ref new Windows::UI::Core::DispatchedHandler([=]()
{
rootPage->loadCats(responseItem, rootPage);
}));
for (int i = 0; i < 100;) {
}
return "(done)";
}).then([taskDone, responseItem, rootPage](Platform::String^ BodyResponse) {
});
});
//rootPage->loadCats(responseItem, rootPage);
}

How to get modified values from dojo table

I have a Dojo table with list of key value pairs. Both fields are editable, once a value is modified i am doing:
var items = grid.selection.getSelected();
However, the modified value is not picked up only the old value is picked.
I tried the following:
dojo.parser.parse()
dojo.parser.instantiate([dojo.byId("tableDiv")]);
but none of them worked. Can any one sugggest a solution for this.
function getAllItems() {
var returnData = "";
//dojo.parser.parse();
//dojo.parser.instantiate([dojo.byId("tableDiv")]);
//grid._refresh();
var items = grid.selection.getSelected();
function gotItems(items, request) {
var i;
for (i = 0; i < items.length; i++) {
var item = items[i];
var paramName = grid.store.getValues(item, "paramName");
var paramValue = grid.store.getValues(item, "paramValue");
if (returnData == "") {
returnData = paramName + "&" + paramValue;
} else {
returnData = returnData + "#" + paramName + "&"
+ paramValue;
} document.getElementById("returnData").value = returnData;
document.getElementById("successFlag").value = "true";
}
}
//Called when loop fails
function fetchFailed(error, request) {
alert("Error reading table data");
}
//Fetch the data.
jsonStore.fetch({
onComplete : gotItems,
onError : fetchFailed
});
}

JSFL - Adding a movieclip to a specific layer and frame

I am trying to replace an outdated movieclip with a newer one.
To do this I'm usin JSFL to locate the old movieclips, save a reference, then add the new version in its place.
I have looked at addItem addItemToDocument and they successfully add the clip, but I'm unsure of how to add it to the specific layer and frame that the old instance of the movieclip was on.
Halps
Replacing all instances of the old movieclip with instances of the new movieclip, could be an easier solution.
All instances of the old movieclip can be found by parsing the timelines of the flash document.
Here is some code:
var _doc = (fl.getDocumentDOM() ? fl.getDocumentDOM() : fl.createDocument());
var _lib = _doc.library;
fl.outputPanel.clear();
ReplaceItemWithItem('Game Layouts/card holder', 'Game Layouts/card holder new');
function ReplaceItemWithItem(oldmcname, newmcname)
{
var item1 = GetItem(oldmcname);
var item2 = GetItem(newmcname);
if (!item1) return false;
if (!item2) return false;
if (oldmcname == newmcname)
return true;
return ReplaceAllItems(item1, item2);
}
function ReplaceAllItems(item1, item2)
{
var timelines = _doc.timelines;
var i, l = timelines.length;
var items = _lib.items;
var changed = false;
// Main timelines
for (i = 0; i < l; i++)
{
var timeline = timelines[i];
changed |= ReplaceItems(timeline, item1, item2);
}
// Timelines in library items
for (i = 0, l = items.length; i < l; i++)
{
var item = items[i];
switch (item.itemType)
{
case "movie clip":
case "graphic":
case "button":
changed |= ReplaceItems(item.timeline, item1, item2);
break;
}
}
return changed;
}
function ReplaceItems(timeline, item1, item2)
{
var changed = false;
if (timeline && item1 && item2)
{
var layers = timeline.layers;
var lay, layl = layers.length;
for (lay = 0; lay < layl; lay++)
{
var layer = layers[lay];
var frames = layer.frames;
var fr, frl = frames.length;
for (fr = 0; fr < frl; fr++)
{
var frame = frames[fr];
if (frame && frame.startFrame == fr)
{
var elements = frame.elements;
var e, el = elements.length;
for (e = 0; e < el; e++)
{
var elem = elements[e];
if (elem && elem.elementType == "instance") // Elements can be empty
{
var item = elem.libraryItem;
if (item.name == item1.name)
{
elem.libraryItem = item2;
changed = true;
}
}
}
}
}
}
}
return changed;
}
function GetItem(itemname)
{
if (!_lib.selectItem(itemname))
{
alert("'" + name + "' does not exist in the library!");
return null;
}
return _lib.getSelectedItems()[0];
}
Hope this helps!

InDesign copy layer to another document

I am trying to write a script that copies a layer from one document into another.
var srcDocName = 0;
var destDocName = 1;
var layerNameOriginal = "Original";
var layerNameCopyTo = "Destination";
var destDoc = app.documents.item(destDocName);
var layerSrc = app.documents.item(srcDocName).layers.item(layerNameOriginal);
try {
layerSrc.duplicate(destDoc, ElementPlacement.INSIDE);
}
catch(e) {
alert(e)
}
Apparently this works in Photoshop but not in InDesign. I have been trying for ages to find some decent documentation for InDesign scripting. But all I can find is the CS scripting guide, which isn't of much use.
http://wwwimages.adobe.com/www.adobe.com/content/dam/Adobe/en/products/indesign/pdfs/InDesignCS5_ScriptingGuide_JS.pdf
If someone can point me to a good reference to the object model I would be grateful.
After some more googling I finally found the answer:
var sourceLayer = app.documents[0].layers.itemByName("Layer1");
var destLayer = app.documents[1].layers[0];
sourceLayer.pageItems.everyItem().duplicate(destLayer);
I also came across jongware which seems to be a complete Object reference extracted directly out of Adobe CS.
You can use this script: https://redokun.com/blog/indesign-copy-entire-layer-one-file-another
The underlying implementation is basically the same, but we've added a UI so it's not necessary to edit the script every time the layer name changes.
Edit: We've been told that the solution above doesn't work with threaded text frames, so I re-wrote the script. The new implementation is way more complex but it now supports threaded TFs.
To expand on the solution offered by Loopo and offer you the ability to copy all layers from 1 document to another...
main();
function main()
{
var source = GetSourceDocument();
if(source == -1)
{
return;
}
var target = GetTargetDocument ();
if(target == -1)
{
return;
}
if(target == source)
{
return;
}
copyLayersOver(source, target);
}
function GetSourceDocument()
{
var returnVal = -1;
var oldPrefs = app.scriptPreferences.userInteractionLevel;
app.scriptPreferences.userInteractionLevel=UserInteractionLevels.INTERACT_WITH_ALL;
var dialog = app.dialogs.add({name:"Document to Copy From", canCanel: true, label:"DocumentToCopyFrom"});
var col1 = dialog.dialogColumns.add();
var StringList= [];
for(var i = 0; i<app.documents.length; i++)
{
StringList.push("[" + app.documents[i].index + "] " + app.documents[i].name);
}
var ddl = col1.dropdowns.add({id:"SourceDocDDL", stringList: StringList});
if(dialog.show() == true)
{
returnVal = ddl.stringList[ddl.selectedIndex].split("]")[0].substr(1);
}
else
{
returnVal -1;
}
dialog.destroy();
app.scriptPreferences.userInteractionLevel = oldPrefs;
return returnVal;
}
function GetTargetDocument()
{
var returnVal = -1;
var oldPrefs = app.scriptPreferences.userInteractionLevel;
app.scriptPreferences.userInteractionLevel=UserInteractionLevels.INTERACT_WITH_ALL;
var dialog = app.dialogs.add({name:"Document to Copy To", canCanel: true, label:"DocumentToCopyTo"});
var col1 = dialog.dialogColumns.add();
var StringList= [];
for(var i = 0; i<app.documents.length; i++)
{
StringList.push("[" + app.documents[i].index + "] " + app.documents[i].name);
}
var ddl = col1.dropdowns.add({id:"SourceDocDDL", stringList: StringList});
if(dialog.show() == true)
{
returnVal = ddl.stringList[ddl.selectedIndex].split("]")[0].substr(1);
}
else
{
returnVal -1;
}
dialog.destroy();
app.scriptPreferences.userInteractionLevel = oldPrefs;
return returnVal;
}
function copyLayersOver(source, target)
{
var sourceDocument = app.documents[source];
var targetDocument = app.documents[target];
var sourceLayers = sourceDocument.layers;
//Match the number of pages
while(targetDocument.pages.length < sourceDocument.pages.length)
{
targetDocument.pages.add();
}
//copy the layers over
for(var i= 0; i < sourceLayers.length; i++)
{
var names = targetDocument.layers.everyItem().name;
var merge = false;
for(var y = 0; y < names.length; y++)
{
if(names[y] == sourceLayers[i].name)
{
merge = true;
break;
}
}
if(merge)
{
var targetLayer = targetDocument.layers.add();
targetLayer.name = "temp";
sourceLayers[i].pageItems.everyItem().duplicate(targetLayer);
targetDocument.layers.itemByName(sourceLayers[i].name).merge(targetLayer);
}
else
{
var targetLayer = targetDocument.layers.add();
targetLayer.name = sourceLayers[i].name;
targetLayer.layerColor = sourceLayers[i].layerColor;
sourceLayers[i].pageItems.everyItem().duplicate(targetLayer);
}
}
}

Reducing score in relation to countdown timer

I have a quiz written in actionscript 2. Everything is going swimmingly except that I can't figure out how to get the score to reduce by one point for every second it takes to answer the question.
So... max score is 30 points for each question and there is a 30 sec timer... and so that the quiz is more challenging I'd like it to reduce by 1 point for every second it takes to answer.
Here is my code... and thanks in advance...
Answer0Button.enabled=false; button0._visible=false;
Answer1Button.enabled=false; button1._visible=false;
Answer2Button.enabled=false; button2._visible=false;
Answer3Button.enabled=false; button3._visible=false;
Answer4Button.enabled=false; button4._visible=false;
Answer5Button.enabled=false; button5._visible=false;
function countdown() {
counter--;
countdown_txt.text = counter;
if (counter == 0) {
Answer0Button.enabled=false;
Answer1Button.enabled=false;
Answer2Button.enabled=false;
Answer3Button.enabled=false;
Answer4Button.enabled=false;
Answer5Button.enabled=false;
clearInterval(intID);
AnswerPopUp_mc.gotoAndPlay(1);
AnswerPopUp_mc.AnswerPopUp.DisplayResult.htmlText = "" + TimeIsUp + "";
}
}
// defining variables for data
var ChosenNumberOfQuestions = int(0); // Number of questions in quiz
var TotalNumberOfQuestions = int(0); // Total number of questions in XML file
var NumberOfQuestions = int(0); // min of two above
var QuestionCounter = int(0); // for dynamicaly showing questions
var CurrentQuestion = QuestionCounter + 1; // for dynamicaly showing questions
var Points = 0; // for each question
var TotalPoints = 0; // Max Points
var Score = 0; // display total score
var NumberOfCorrectAnswers = 0; // counter for questions answered correctly
var RandOrderQuestions = new Array();
var Questions = new Array();
var Images = new Array();
var CorrectAnswers = new Array();
var Answers = new Array();
var ExplanationsIfCorrect = new Array();
var ExplanationsIfNotCorrect = new Array();
var TimesForSolving = new Array();
var NumberOfPoints = new Array();
// roll over states for buttons
button0.onEnterFrame = function() {
if (mouse_over_button0) {
_root.button0.nextFrame();
} else {
_root.button0.prevFrame();
}
};
button1.onEnterFrame = function() {
if (mouse_over_button1) {
_root.button1.nextFrame();
} else {
_root.button1.prevFrame();
}
};
button2.onEnterFrame = function() {
if (mouse_over_button2) {
_root.button2.nextFrame();
} else {
_root.button2.prevFrame();
}
};
button3.onEnterFrame = function() {
if (mouse_over_button3) {
_root.button3.nextFrame();
} else {
_root.button3.prevFrame();
}
};
button4.onEnterFrame = function() {
if (mouse_over_button4) {
_root.button4.nextFrame();
} else {
_root.button4.prevFrame();
}
};
button5.onEnterFrame = function() {
if (mouse_over_button5) {
_root.button5.nextFrame();
} else {
_root.button5.prevFrame();
}
};
// Label Color
var changeColor2 = new Color(label_mc.coloredLabel);
changeColor2.setRGB(labelColor);
// Change Buttons Color
var changeColorA = new Color(button0.letterA_mc.letterA);
changeColorA.setRGB(labelColor);
var changeColorB = new Color(button1.letterB_mc.letterB);
changeColorB.setRGB(labelColor);
var changeColorC = new Color(button2.letterC_mc.letterC);
changeColorC.setRGB(labelColor);
var changeColorD = new Color(button3.letterD_mc.letterD);
changeColorD.setRGB(labelColor);
var changeColorE = new Color(button4.letterE_mc.letterE);
changeColorE.setRGB(labelColor);
var changeColorF = new Color(button5.letterF_mc.letterF);
changeColorF.setRGB(labelColor);
// Change Color of points, counter...
var changeColorCounter = new Color(countdown_txt);
changeColorCounter.setRGB(labelColor);
var changeSlashColor = new Color(slash);
changeSlashColor.setRGB(labelColor);
var changeCurrQColor = new Color(DisplayCurrQ);
changeCurrQColor.setRGB(labelColor);
var changeTotalQColor = new Color(DisplayTotalQ);
changeTotalQColor.setRGB(labelColor);
var changePointsColor = new Color(DisplayPoints);
changePointsColor.setRGB(labelColor);
var changeScoreColor = new Color(DisplayScore);
changeScoreColor.setRGB(labelColor);
// Background Color
new Color (BackGround.bg).setRGB(BackgroundColor);
new Color (FadeIn.bg1.bg).setRGB(BackgroundColor);
// loading data from XML
var xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = function () {
// Default Time for solving
DefaultTimeInSeconds = this.firstChild.attributes.DefaultTimeInSeconds;
trace ("DefaultTime: " + DefaultTimeInSeconds);
// Default Points
DefaultPoints = this.firstChild.attributes.DefaultPoints;
trace ("DefaultPoints: " + DefaultPoints);
// Default comment on answers
DefaultIfCorrectAnswer = this.firstChild.attributes.DefaultIfCorrectAnswer;
DefaultIfWrongAnswer = this.firstChild.attributes.DefaultIfWrongAnswer;
// Default if time is up
TimeIsUp = this.firstChild.attributes.TimeIsUp;
// Random order of questions or not
RandomQuestions = this.firstChild.attributes.RandomQuestions;
trace ("RandomQuestions: " + RandomQuestions);
// Number Of Questions
ChosenNumberOfQuestions = this.firstChild.attributes.NumberOfQuestions;
trace ("ChosenNumberOfQuestions: " + ChosenNumberOfQuestions);
// Counting total number of Questions in XML file
var nodes = this.firstChild.childNodes;
for (var a=0; a<nodes.length; a++){
TotalNumberOfQuestions = a+1;
}
trace ("TotalNumberOfQuestions: " + TotalNumberOfQuestions);
// Finaly - number of questions in QUIZ - min of two above
if (ChosenNumberOfQuestions < TotalNumberOfQuestions) {
NumberOfQuestions = ChosenNumberOfQuestions;
} else {
NumberOfQuestions = TotalNumberOfQuestions;
}
// Random order Questions or not
// first we populate array with question numbers
for(i=0; i<TotalNumberOfQuestions; i++){
RandOrderQuestions[i] = i;
trace(RandOrderQuestions);
}
// if we want random questions we use random sorting of number of questions
if (RandomQuestions == "TRUE") {
RandOrderQuestions.sort(function () {
return random(2) ? true : false;
});
trace(RandOrderQuestions);
}
///////////////////////////
// POPULATING FROM XML
for (var i=0; i < NumberOfQuestions; i++ )
{
// Chose the number of question from RandOrderQuestions array
var numInXML = RandOrderQuestions[i];
trace("Question number in XML: " + numInXML);
// populating questions from XML
Questions[i] = this.firstChild.childNodes[numInXML].childNodes[0].firstChild.nodeValue;
//trace(Questions);
//populating Correct Answers from XML
CorrectAnswers[i] = this.firstChild.childNodes[numInXML].childNodes[1].attributes.correctAnswer;
//trace(CorrectAnswers);
// populating options for answers from XML
var NewArray = new Array(); // temp array for answers for each question
for (var j=0; j < this.firstChild.childNodes[numInXML].childNodes[1].childNodes.length; j++ )
{
trace(i + " "+ j);
NewArray[j] = this.firstChild.childNodes[numInXML].childNodes[1].childNodes[j].firstChild.nodeValue;
//trace(NewArray);
NewArray.sort(function () {
return random(2) ? true : false;
});
}
Answers.push(NewArray); // push answers for this i question in main Answers array
//populating additional options from XML
ExplanationsIfCorrect[i] = this.firstChild.childNodes[numInXML].childNodes[2].attributes.explanationIfCorrect;
ExplanationsIfNotCorrect[i] = this.firstChild.childNodes[numInXML].childNodes[2].attributes.explanationIfNotCorrect;
TimesForSolving[i] = this.firstChild.childNodes[numInXML].childNodes[2].attributes.timeInSeconds;
NumberOfPoints[i] = this.firstChild.childNodes[numInXML].childNodes[2].attributes.points;
Images[i] = this.firstChild.childNodes[numInXML].childNodes[2].attributes.imageIfCorrect;
Images[i] = this.firstChild.childNodes[numInXML].childNodes[2].attributes.imageIfIncorrect;
}
trace("Questions: " + Questions); trace("Correct Answers: " + CorrectAnswers);
trace(NewArray);
trace(ExplanationsIfCorrect); trace(ExplanationsIfNotCorrect); trace(TimesForSolving); trace(NumberOfPoints); trace(Images);
// show first question (QuestionCounter=0)
QuestionNumber.text = "Question #" + 1;
QuestionDisplay.htmlText = Questions[QuestionCounter];
// show answers for first question (QuestionCounter=0)
if (0 < Answers[QuestionCounter].length){ Answer0Display.text = Answers[QuestionCounter][0]; Answer0Button.enabled=true; button0._visible=true;} else { button0._visible=false;}
if (1 < Answers[QuestionCounter].length){ Answer1Display.text = Answers[QuestionCounter][1]; Answer1Button.enabled=true; button1._visible=true;} else { button1._visible=false;}
if (2 < Answers[QuestionCounter].length){ Answer2Display.text = Answers[QuestionCounter][2]; Answer2Button.enabled=true; button2._visible=true;} else { button2._visible=false;}
if (3 < Answers[QuestionCounter].length){ Answer3Display.text = Answers[QuestionCounter][3]; Answer3Button.enabled=true; button3._visible=true;} else { button3._visible=false;}
if (4 < Answers[QuestionCounter].length){ Answer4Display.text = Answers[QuestionCounter][4]; Answer4Button.enabled=true; button4._visible=true;} else { button4._visible=false;}
if (5 < Answers[QuestionCounter].length){ Answer5Display.text = Answers[QuestionCounter][5]; Answer5Button.enabled=true; button5._visible=true;} else { button5._visible=false;}
// show image if defined
if (Images[QuestionCounter]){ loadMovie(Images[QuestionCounter],"imgContainer"); } else { }
// determine the number of points
if (NumberOfPoints[QuestionCounter]){ Points = NumberOfPoints[QuestionCounter] } else { Points = DefaultPoints }
// start counter
if (TimesForSolving[QuestionCounter]){
countdown_time = TimesForSolving[QuestionCounter]
} else {
countdown_time = DefaultTimeInSeconds
} // now call the function
counter = countdown_time;
countdown_txt.text = countdown_time;
clearInterval(intID);
intID = setInterval(countdown,1000);
}
I don't see where you added your scores, but I believe you can set score = counter since your counter is the time remaining.