Get Score Output in Reward Page - ActionScript 3.0 - actionscript-3

I have a question how can i show the output "score" in another page? I using the Adobe Animate;AS3. Have anyone experience with this? This work is for my Assignment in University.
This an example of the app https://imgur.com/a/VxhEoGk
The Action Script 3 code:
[1] AS for game: https://codebeautify.org/actionscript/y223f6311
[2] AS for reward: https://codebeautify.org/actionscript/y22dfa9e5
[3] AS for user enter their name:
function goHome(e:MouseEvent) : void {
user_input = name_input.text
gotoAndStop('home');
}
And when I wanted to show the user name in another page just use
name_reward.text= user_input;
I've try many way but doesn't work. It's possible for me to get the score output at reward page? Like a name that user need to enter when entering the homepage of this application.
Thank in advance for your help

Related

JSON If Statement Not Working

I'm not use to coding in JSON so I don't know what I'm doing wrong. Basically, what I'm trying to achieve is that there is a variable for a web hook that basically says "alert type = 1" means website is up, and "alert type =2" means website is down.
I'm trying to create a webhook JSON code to send a different message if the alert type is set to either 1 or 2. Please help me in understanding what I'm doing wrong.
Here is the code I've got so far;
{.if (* alertType *) = "2"
}
Our Website is Offline {.if
}

Quartz composer - output specific number

I'm trying to achieve something quite simple in Quartz Composer. I'm not sure which patches to use. I'm used to Max/MSP, and I can't find an equivalent for doing something simple: send a number out of an output with a bang or toggle. In Max you just use the a float or integer object, set the number and then send it with bang. I cannot find a simple number patch, or the equivalent of a bang. Is there such a thing?
Any help would be much appreciated.
Quartz Composer isn't event-based. You'll have to manage yourself the way you want to output things.
If I understand well : you want to output a number on an event (keyboard or else, I guess) and keep it until the next event.
If you already know your values, I suggest you connect to a Number Multiplexer, for example :
keyboard -> counter -> multiplexer -> image with string -> sprite
If you don't know them :
keyboard -> sample & hold (sample input)
dynamic number -> sample & hold (value input) -> image with string -> sprite
Keyboard is there to generate your 'event'. The values won't move until the next event your throw (managed by the Counter patch Increment/Decrement inputs in the first example, by the Sample input in the second).

Performing search in wp8

I have a question in WP8 app development.
So that's what I wanna do:
I have multiple busses routes like:
Bus 1: start's from street ... end's with street ...
Bus 2.........
I add 2 text boxes where user enter:
1. From(street name) and 2. Destination(street name)
and I need to perform a search in every bus route and show the results with wich bus user can get to destination.
the only thing I need to understand is where to save the bus route and how to perfom a search in that file or string? here's a little code:
int search(string *from, string *to)
{
char[200]; int busnumber;
//first compare if the from matches
for(busnumber=1; bussnumber<10; bussnumber++)
{
if(stricmp(from,busnr[busnumber])==0)
{
if(stricmp(to,busnr[busnumber])==0)
{
return busnumber;
}
}
}
}
I didn't understand your question well but here's what I can think of.
If you have data ordered in following manner:
[bus_number][start][destination]
and your data omit all the middle bus stops, then you have to simply iterate through the list.
Although if there is an option that user wants to find path to a place for which there is no direct bus, and he will have to change buses, then you have to use graph and an algorith that efficiently searches the path.
You will also have to use weighted graph if your data is as following:
[bus_number][start][busstop2][busstop3]...[busstop(n-1)][end]
and find a path with a constraint for example that you cannot have more than three buses changes.This algorithm will be a little bit complicated.

Saving and Loading progress in action script 3

I've looked everywhere for this answer..but I am not quite sure on how to do it exactly...
I am making a Flash Game using Flash AS3...
I need options where user can save and load their progress..
can somebody give a step by step on how to do this please? I am very new to actionscript...
usually other tuts shows u how to save certain variables
Cookies!
Lucky us it's very simple. Unlucky us it's not obvious how it's done:
// have that referenced all the time:
var cookies: SharedObject = SharedObject.getLocal("myGameData");
// start saving
cookies.data.progress = 50;
cookies.data.lives = 5;
cookies.data.anyRandomVariable = "my name or something";
cookies.flush();
// now it's saved
// start loading
var progress: Number = cookies.data.progress;
var lives: int = cookies.data.lives = 5;
var anyRandomBlah: String = cookies.data.anyRandomVariable;
// now it's loaded
(following the comments above...)
Yes, pretty much along those lines. I was asking questions to try to get you to see that you do actually have variables/data which you'd save. =b
If you want to save in the middle of the level, it is up to you... I don't know how you've designed your game, but basically you can write the saving code to trigger whenever you want based on any conditions you want.
For saving in the middle of levels, since you are handling the saving and loading you could try having a value like level "7.5" or whatever notation you want to indicate a level that is partway done. Or just use whole numbers like 750 and treat it as a percentage (level 7 at 50% done). And so forth. It's up to you.
A very similar question has been asked how to save a current frame value using a SharedObject. In your case, replace 'current frame' with whatever values you want to save:
Actionscript 3 saving currentframe location to local hard drive?

How to update Extjs Progress Bar with JSON results?

I am facing some difficulties in getting my progress bar to retrieve its progress from Json results and update the progress bar based on the timer check of every 10 seconds.
I am able to create a json result like this:
{"success":true, "progress":0.2}
I suppose the general idea is that, I need a task with interval set to 10sec, and having the runner to run the task, and when the progress bar starts working, the runner will check on the results from the Json, and update the progress bar as per required.
Code so far:
var task = {
run: function(){
// what to add here?
},
interval: 10000
}
}
Having said so, I am having difficulties on:
How do I add the Json portion in the task?
How do I update the progress bar with the given Json result?
Thank you very much.
I have managed to get this up and running, apparently this is the missing jigsaw to my question. For anyone who are stuck with this like me.
Basically just add this portion which will retrieve the json result from your stated url, and on success update your progress bar.
And the bare minimum code to be embedded within your task like so:
Ext.Ajax.request({
url: 'getStatus',
success: function(r) {
var i = Ext.decode(r.responseText).progress;
progressbar.updateProgress(count +' completed');
}
});
I don't know what stack you are running on but what you can do in term of general approach.
How do I add the Json portion in the task?
If you have access to memcached or something like that you can use that to store your progress of the task. On the same fashion you can use a database or even file, since what do you want to store is only a number.
After how to give a progress number of various task that you don't know how much time it would take. I would say if your processing is loop based like you update n rows, you can just use that as a meter.
I think you don't have to worry the progress meter to be accurate just it should give a rough idea where the processing is.
How do I update the progress bar with the given Json result?
ExtJS have a TaskManager it would allow you to do an ajax query every n second and pull out the progress and update the attached progress bar.
// Start a simple clock task that updates a div once per second
var task = {
run: function(){
Ext.fly('clock').update(new Date().format('g:i:s A'));
},
interval: 1000 //1 second
}
Ext.TaskMgr.start(task);