00:00
00:00
B1KMusic
Hi. I make games and software. I'm not on NG much, but feel free to peruse my youtube and gitlab for interesting stuff.

Braden @B1KMusic

Age 29, Male

Programmer/Musician/

fish

Earth, Milky Way

Joined on 6/19/11

Level:
10
Exp Points:
952 / 1,110
Exp Rank:
71,847
Vote Power:
5.20 votes
Rank:
Police Sergeant
Global Rank:
8,675
Blams:
42
Saves:
1,040
B/P Bonus:
12%
Whistle:
Normal
Medals:
799

B1KMusic's News

Posted by B1KMusic - September 12th, 2011


A Supervote is this silly thing on that old site Myyearbook.com, where one can vote with the power of 5 people, but it costed 10 dollars in the pretend money system

I'm thinking it would be epic if there was a supervote here :D With the limitations/features:

Must be registered to use it,

one supervote per week, meaning you supervote one submission, to supervote another submission, you have to wait a week

counts 10-20 people

votes as a 5 and nothing else, we don't need super zero-voters, that would suck XD

use it to show people that you REALLY love their submission :D

On that note, there should be an eleventh star or a superstar in the review system, or something with the same shit, except maybe you can only use it once a day or something.

I dunno, I'm just sayin'


Posted by B1KMusic - August 19th, 2011


here it is, the final version of the clock, a project which took a solid 8 hours of (on computer) work to complete ;)

I spent a good three days figuring out how to actually DRAW the 7-seg display on graph paper, with different variations, such as 3D, 2D, and with a shadow, I learned that a basic 7-seg can be made with a 3X5 grid, all you do is draw slashes in the corners and X's in the sides* (with pencil) and then draw the shape of the number, again, with pencil. After the shape has been made, carefully trace over the lines with an ink pen, then erase the pencil marks, viola!

*Looks kinda like this:

\_/
X_X
/_\
Features:

*Pays tribute to the famous 7-segment display you see every morning

*Will reliably tell you the time at 12 fps (uses your computer's time, so fps isn't a concern)

*Scrolling to the right by prressing the right arrow key or D (for you W,A,S,D users :P) shows the current seconds

*3 fuckin D!

*and more...

100%, all, of the content in this flash was made by yours truly (me) :D

I made a digital clock, but by using movie clips instead of a text field, so naturally, this is a lot more tedious.

In this, the latest version, I drew the 7-segment display in 3 dimensions, and included seconds and a scrolling feature so the flash isn't long as shit :)

//init
n1.gotoAndStop("n8");
n2.gotoAndStop("n8");
n3.gotoAndStop("n8");
n4.gotoAndStop("n8");
n5.gotoAndStop("n8");
n6.gotoAndStop("n8");
//end init
//The above lines initialize the clips to play at the frame "n8" (number 8), and you will see it briefly
ch = createEmptyMovieClip("c", 1);
ch.lineTo(800, 320);
CAM = new VCam(ch);
ch._y = 180;
ch._x = 390;
//830
//390
//the above script creates a camera, for this, you need the VCam.as I posted about earlier
onEnterFrame = function () {
if (Key.isDown(Key.RIGHT) && ch._x<=830 || Key.isDown(key.D) && ch._x<=830) {
ch._x += 160;
} else if (Key.isDown(Key.LEFT) && ch._x>=390 || Key.isDown(key.A) && ch._x>=390) {
ch._x -= 160;
}
if (ch._x<390) {
ch._x = 390;
} else if (ch._x>830) {
ch._x = 830;
}
//the most complex part; I had to revise and revise to get the right coordinates, trace() is your friend
//here :)
now = new Date();
h = now.getHours();
m = now.getMinutes();
s = now.getSeconds();
//creates the hour, minute, and second variables (OOP classes, learn em!)
//hours
if (h == 0 || h == 12) {
n1.gotoAndStop("n1");
n2.gotoAndStop("n2");
block._visible = false
} else if (h == 1 || h == 13) {
n1.gotoAndStop("n0");
n2.gotoAndStop("n1");
block._visible = true
} else if (h == 2 || h == 14) {
n1.gotoAndStop("n0");
n2.gotoAndStop("n2");
block._visible = true
} else if (h == 3 || h == 15) {
n1.gotoAndStop("n0");
n2.gotoAndStop("n3");
block._visible = true
} else if (h == 4 || h == 16) {
n1.gotoAndStop('n0');
n2.gotoAndStop('n4');
block._visible = true
} else if (h == 5 || h == 17) {
n1.gotoAndStop('n0');
n2.gotoAndStop('n5');
block._visible = true
} else if (h == 6 || h == 18) {
n1.gotoAndStop('n0');
n2.gotoAndStop('n6');
block._visible = true
} else if (h == 7 || h == 19) {
n1.gotoAndStop('n0');
n2.gotoAndStop('n7');
block._visible = true
} else if (h == 8 || h == 20) {
n1.gotoAndStop('n0');
n2.gotoAndStop('n8');
block._visible = true
} else if (h == 9 || h == 21) {
n1.gotoAndStop('n0');
n2.gotoAndStop('n9');
block._visible = true
} else if (h == 10 || h == 22) {
n1.gotoAndStop('n1');
n2.gotoAndStop('n0');
block._visible = false
} else if (h == 11 || h == 23) {
n1.gotoAndStop('n1');
n2.gotoAndStop('n1');
block._visible = false
}
//for this, create a giant white square to cover the first digit, which represents the tens for the hours, and instance-name it 'block' also, if you haven't figured out by now, you're supposed to name the number movieclips n1-n6 from left to right, and the frames n0-n9
//minutes
//tens
if (m<10) {
n3.gotoAndStop('n0');
} else if (m<20) {
n3.gotoAndStop('n1');
} else if (m<30) {
n3.gotoAndStop('n2');
} else if (m<40) {
n3.gotoAndStop('n3');
} else if (m<50) {
n3.gotoAndStop('n4');
} else {
n3.gotoAndStop('n5');
}
//saves some heart-ache
function mn(t) {
//mn = MiNutes
//t = time
n4.gotoAndStop(t);
}
//ones
if (m == 0 || m == 10 || m == 20 || m == 30 || m == 40 || m == 50) {
mn('n0');
} else if (m == 1 || m == 11 || m == 21 || m == 31 || m == 41 || m == 51) {
mn('n1');
} else if (m == 2 || m == 12 || m == 22 || m == 32 || m == 42 || m == 52) {
mn('n2');
} else if (m == 3 || m == 13 || m == 23 || m == 33 || m == 43 || m == 53) {
mn('n3');
} else if (m == 4 || m == 14 || m == 24 || m == 34 || m == 44 || m == 54) {
mn('n4');
} else if (m == 5 || m == 15 || m == 25 || m == 35 || m == 45 || m == 55) {
mn('n5');
} else if (m == 6 || m == 16 || m == 26 || m == 36 || m == 46 || m == 56) {
mn('n6');
} else if (m == 7 || m == 17 || m == 27 || m == 37 || m == 47 || m == 57) {
mn('n7');
} else if (m == 8 || m == 18 || m == 28 || m == 38 || m == 48 || m == 58) {
mn('n8');
} else if (m == 9 || m == 19 || m == 29 || m == 39 || m == 49 || m == 59) {
mn('n9');
}
//first half of the MOST TEDIOUS PART
//SECONDS
function sn(t) {
//SecoNds(Time)
n6.gotoAndStop(t);
}
//tens
if (s<10) {
n5.gotoAndStop('n0');
} else if (s<20) {
n5.gotoAndStop('n1');
} else if (s<30) {
n5.gotoAndStop('n2');
} else if (s<40) {
n5.gotoAndStop('n3');
} else if (s<50) {
n5.gotoAndStop('n4');
} else {
n5.gotoAndStop('n5');
}
//ones
if (s == 0 || s == 10 || s == 20 || s == 30 || s == 40 || s == 50) {
sn('n0');
} else if (s == 1 || s == 11 || s == 21 || s == 31 || s == 41 || s == 51) {
sn('n1');
} else if (s == 2 || s == 12 || s == 22 || s == 32 || s == 42 || s == 52) {
sn('n2');
} else if (s == 3 || s == 13 || s == 23 || s == 33 || s == 43 || s == 53) {
sn('n3');
} else if (s == 4 || s == 14 || s == 24 || s == 34 || s == 44 || s == 54) {
sn('n4');
} else if (s == 5 || s == 15 || s == 25 || s == 35 || s == 45 || s == 55) {
sn('n5');
} else if (s == 6 || s == 16 || s == 26 || s == 36 || s == 46 || s == 56) {
sn('n6');
} else if (s == 7 || s == 17 || s == 27 || s == 37 || s == 47 || s == 57) {
sn('n7');
} else if (s == 8 || s == 18 || s == 28 || s == 38 || s == 48 || s == 58) {
sn('n8');
} else if (s == 9 || s == 19 || s == 29 || s == 39 || s == 49 || s == 59) {
sn('n9');
}
//part two of the most tedious part
};

This took a solid 8 hours (work-time only, the time over all was about 3 days) to do, mainly drawing and naming shit. The rest, which probably took about 1 hour out of the total 8, was coding (the code goes into one single frame, by the way)

The finished product

Other versions:

First Version

Color Version (use C to activate color change, and 0-9 to change color)

First 3D version

Below is a picture of the .Fla

Yeh, it's AS2, don't hate.

Organization of fucking EVERYTHING really saved my ass on this; I used a grid to EXACT the location of everything you see, I used exact lines and exact names for everything, I organized even the coding with Documentation.

Lol, do you think I should post this to the portal? I don't really know if it's PORTAL material but it is in fact a gadget, a gadget that tells you the time :D

Advanced 3D Digital Clock!


Posted by B1KMusic - August 19th, 2011


I just made a slightly newer version of the clock and a 3D version...

Color-changer clock (press C to turn color changing on, and 0-9 to change color)

3D(ish) clock

//init
n1.gotoAndStop("n8");
n2.gotoAndStop("n8");
n3.gotoAndStop("n8");
n4.gotoAndStop("n8");
//end init
onEnterFrame = function () {
now = new Date();
h = now.getHours();
m = now.getMinutes();
//hours
if (h == 0 || h == 12) {
n1.gotoAndStop("n1");
n2.gotoAndStop("n2");
} else if (h == 1 || h == 13) {
n1.gotoAndStop("n0");
n2.gotoAndStop("n1");
} else if (h == 2 || h == 14) {
n1.gotoAndStop("n0");
n2.gotoAndStop("n2");
} else if (h == 3 || h == 15) {
n1.gotoAndStop("n0");
n2.gotoAndStop("n3");
} else if (h == 4 || h == 16) {
n1.gotoAndStop('n0');
n2.gotoAndStop('n4');
} else if (h == 5 || h == 17) {
n1.gotoAndStop('n0');
n2.gotoAndStop('n5');
} else if (h == 6 || h == 18) {
n1.gotoAndStop('n0');
n2.gotoAndStop('n6');
} else if (h == 7 || h == 19) {
n1.gotoAndStop('n0');
n2.gotoAndStop('n7');
} else if (h == 8 || h == 20) {
n1.gotoAndStop('n0');
n2.gotoAndStop('n8');
} else if (h == 9 || h == 21) {
n1.gotoAndStop('n0');
n2.gotoAndStop('n9');
} else if (h == 10 || h == 22) {
n1.gotoAndStop('n1');
n2.gotoAndStop('n0');
} else if (h == 11 || h == 23) {
n1.gotoAndStop('n1');
n2.gotoAndStop('n1');
}
//minutes
//tens
if (m<10) {
n3.gotoAndStop('n0');
} else if (m<20) {
n3.gotoAndStop('n1');
} else if (m<30) {
n3.gotoAndStop('n2');
} else if (m<40) {
n3.gotoAndStop('n3');
} else if (m<50) {
n3.gotoAndStop('n4');
} else {
n3.gotoAndStop('n5');
}
function mn(t) {
//mn = MiNutes
//t = time
n4.gotoAndStop(t);
}
//ones
if (m == 0 || m == 10 || m == 20 || m == 30 || m == 40 || m == 50) {
mn('n0');
} else if (m == 1 || m == 11 || m == 21 || m == 31 || m == 41 || m == 51) {
mn('n1');
} else if (m == 2 || m == 12 || m == 22 || m == 32 || m == 42 || m == 52) {
mn('n2');
} else if (m == 3 || m == 13 || m == 23 || m == 33 || m == 43 || m == 53) {
mn('n3');
} else if (m == 4 || m == 14 || m == 24 || m == 34 || m == 44 || m == 54) {
mn('n4');
} else if (m == 5 || m == 15 || m == 25 || m == 35 || m == 45 || m == 55) {
mn('n5');
} else if (m == 6 || m == 16 || m == 26 || m == 36 || m == 46 || m == 56) {
mn('n6');
} else if (m == 7 || m == 17 || m == 27 || m == 37 || m == 47 || m == 57) {
mn('n7');
} else if (m == 8 || m == 18 || m == 28 || m == 38 || m == 48 || m == 58) {
mn('n8');
} else if (m == 9 || m == 19 || m == 29 || m == 39 || m == 49 || m == 59) {
mn('n9');
}
};

A new section I added for pointless frills is this:

//Color
col1 = new Color(n1);
col2 = new Color(n2);
col3 = new Color(n3);
col4 = new Color(n4);
colc = new Color(C);
colt = new Color(CT)
red = 0xCC0000;
blue = 0x0000CC;
green = 0x00CC00;
yellow = 0xFFCC00;
black = 0x000000;
function colset(c) {
col1.setRGB(c);
col2.setRGB(c);
col3.setRGB(c);
col4.setRGB(c);
colc.setRGB(c);
}
O = {};
Key.addListener(O);
O.onKeyDown = function() {
KEY = Key.getCode();
if (KEY == key.C && !Cv) {
Cv = true;
CT.text = "COLOR MODE: ON"
colt.setRGB(0x00CC00)
} else if (KEY == key.C && Cv) {
Cv = false;
CT.text = "COLOR MODE: OFF"
colt.setRGB(0xCC0000)
}
if (Cv) {
if (KEY == key.ONE) {
colset(blue);
} else if (KEY == key.TWO) {
colset(red);
} else if (KEY == key.THREE) {
colset(green);
} else if (KEY == key.FOUR) {
colset(yellow);
} else if (KEY == key.FIVE) {
colset(black);
} else if (KEY == key.SIX) {
colset(0xCCCCCC);
} else if (KEY == key.SEVEN) {
colset(0xAAAAAA);
} else if (KEY == key.EIGHT) {
colset(0x888888);
} else if (KEY == key.NINE) {
colset(0x666666);
} else if (KEY == key.ZERO) {
colset(0xFFFFFF);
}
}
};

Wasn't nearly as tedious.

col1-4 define each of the numbers, colc defines the colon in the center, colt changes the text's color to give the On and Off indicators more of a visual cue.

red, blue, yellow, etc. defines the colors, this step isn't really that necessary, but it makes life easier

function colset just makes it so I don't have to type a million lines to change the color

O = {}, Key.addlistener(O) and O.onKeyDown create a key listening event

all the rest ias pretty self-explanatory.


Posted by B1KMusic - August 18th, 2011


the following script is the code I used to make this, a working digital flash clock :D

The process was actually very tedious, as I had to make a condition for all 60 minutes and all 24 hours of the day. I drew, coded, and designed everything in this thing, so enjoy :D

//init
n1.gotoAndStop("n8");
n2.gotoAndStop("n8");
n3.gotoAndStop("n8");
n4.gotoAndStop("n8");
//end init
onEnterFrame = function () {
now = new Date();
h = now.getHours();
m = now.getMinutes();
//hours
if (h == 0 || h == 12) {
n1.gotoAndStop("n1");
n2.gotoAndStop("n2");
} else if (h == 1 || h == 13) {
n1.gotoAndStop("n0");
n2.gotoAndStop("n1");
} else if (h == 2 || h == 14) {
n1.gotoAndStop("n0");
n2.gotoAndStop("n2");
} else if (h == 3 || h == 15) {
n1.gotoAndStop("n0");
n2.gotoAndStop("n3");
} else if (h == 4 || h == 16) {
n1.gotoAndStop('n0');
n2.gotoAndStop('n4');
} else if (h == 5 || h == 17) {
n1.gotoAndStop('n0');
n2.gotoAndStop('n5');
} else if (h == 6 || h == 18) {
n1.gotoAndStop('n0');
n2.gotoAndStop('n6');
} else if (h == 7 || h == 19) {
n1.gotoAndStop('n0');
n2.gotoAndStop('n7');
} else if (h == 8 || h == 20) {
n1.gotoAndStop('n0');
n2.gotoAndStop('n8');
} else if (h == 9 || h == 21) {
n1.gotoAndStop('n0');
n2.gotoAndStop('n9');
} else if (h == 10 || h == 22) {
n1.gotoAndStop('n1');
n2.gotoAndStop('n0');
} else if (h == 11 || h == 23) {
n1.gotoAndStop('n1');
n2.gotoAndStop('n1');
}
//minutes
//tens
if (m<10) {
n3.gotoAndStop('n0');
} else if (m<20) {
n3.gotoAndStop('n1');
} else if (m<30) {
n3.gotoAndStop('n2');
} else if (m<40) {
n3.gotoAndStop('n3');
} else if (m<50) {
n3.gotoAndStop('n4');
} else {
n3.gotoAndStop('n5');
}
function mn(t) {
//mn = MiNutes
//t = time
n4.gotoAndStop(t);
}
//ones
if (m == 0 || m == 10 || m == 20 || m == 30 || m == 40 || m == 50) {
mn('n0');
} else if (m == 1 || m == 11 || m == 21 || m == 31 || m == 41 || m == 51) {
mn('n1');
} else if (m == 2 || m == 12 || m == 22 || m == 32 || m == 42 || m == 52) {
mn('n2');
} else if (m == 3 || m == 13 || m == 23 || m == 33 || m == 43 || m == 53) {
mn('n3');
} else if (m == 4 || m == 14 || m == 24 || m == 34 || m == 44 || m == 54) {
mn('n4');
} else if (m == 5 || m == 15 || m == 25 || m == 35 || m == 45 || m == 55) {
mn('n5');
} else if (m == 6 || m == 16 || m == 26 || m == 36 || m == 46 || m == 56) {
mn('n6');
} else if (m == 7 || m == 17 || m == 27 || m == 37 || m == 47 || m == 57) {
mn('n7');
} else if (m == 8 || m == 18 || m == 28 || m == 38 || m == 48 || m == 58) {
mn('n8');
} else if (m == 9 || m == 19 || m == 29 || m == 39 || m == 49 || m == 59) {
mn('n9');
}
};

If you want the FLA, just make a comment saying so :D

If this isn't the ULTIMATE proof that Flash 8 and actionscript 2 are object oriented, I don't know what is.

Digital clock


Posted by B1KMusic - July 31st, 2011


First, did you download VCam.as from my previous post?

Did you follow the instructions down to the letters?

good, Copy/paste the below script into a new flash document, and be amazed by how you just created a VCam that follows what ever object you decided to name "char" with no problem at all

The two most important lines are:

CAM = new VCam(cam), which creates the camera
and
onEnterFrame = function(){ CAM.Follow(cam,ch) }, which makes it follow "char"

you don't have to code out a movie clip, but it can look a bit bad if you have a big, whopping camera object sitting on the stage.

The four lines that are inbold are the ones that create the camera, the rest illustrates that it works

script:

//This is an example to help use and show the power of VCam.as
/***** START CAMERA *****/

this.createEmptyMovieClip("cam", 1);
cam.lineTo(550, 400);
CAM = new VCam(cam);
onEnterFrame = function () { CAM.Follow(cam, ch) }

/***** END CAMERA *****/
this.createEmptyMovieClip("ch", 2);
ch.attachMovie("char", char, 2);
ch._x = 550;
/*
1 make a movie clip, name it char
2 Right click it in the library and click 'Linkage'
3 check "Export for actionscript"
*/

explanation:

1 | //This is an example to help use and show the power of VCam.as
2 | /***** START CAMERA *****/
3 | this.createEmptyMovieClip("cam", 1);
4 | cam.lineTo(550, 400);
5 | CAM = new VCam(cam);
6 | onEnterFrame = function () { CAM.Follow(cam, ch) }
7 | /***** END CAMERA *****/
8 | this.createEmptyMovieClip("ch", 2);
9 | ch.attachMovie("char", char, 2);
10 | ch._x = 550;
11 | /*
12 | make a movie clip, name it char
13 | Right click it in the library and click 'Linkage'
14 | check "Export for actionscript"
15 | */

1 - emphasises the fact that this is an example

2 - helps document the code incase you need to tweak somehting and have 1000 lines of code

3 - creates an empty movie clip with no mass, no height, width, or anything

4 - draws a line from 0,0 to 550,400 (top left to bottom right), giving it height and width

5 - uses the class VCam(hope you followed the integration instructions) to classify the line as a camera

6 - Makes the camera follow "ch", to be defined later, 12 times a second

7 - Documentation, no real significance, See line 2

8 - creates another lifeless movieclip, this time with depth of 2 and name ch, the depth needs to be different, or it replaces the camera entirely and fucks up the whole movie

9 - attaches the movieclip in the library under the name "char"

10 - helps illustrate the fact the the camera IS, in fact, working

11-15 - instructions on how to make the char object


Posted by B1KMusic - July 29th, 2011


You may have noticed that the Damn function Follow can ONLY be used in the movie clip actionscript panel. Well this is a solution!

Here is an entirely new Cam Class

VCam.as

Instructions for usage are inside the file, but the basic basic basics are that the only lines you need to put to create a VCam in Flash AS2 are:

inside of the movieclip:
var CM = new VCam()

in the main actions panel:
var C = cam.CM
onEnterFrame = function(){
C.Follow(cam,char)
}
5 lines, 5 lines instead of a whole shitload of confusing code that is annoying to have to copy/paste every time you need a VCam

Assuming you gave instance names, the camera is 'cam' and the character to follow is 'char'

All script goes inside frames

There are three variables used in the class that can be changed outside of it, allowing intricate things to happen, they are:

Floor, Mouse, and Visible

Floor makes the camera follow the object riding the bottom of the movie, rather than being centered

Mouse makes the camera Follow the mouse

Visible decides whether or not the camera is visible, this one is different, however.

To use Visible, place

VCam.Visible = true
CM = new VCam(this)

These two lines need to be arranged exactly like that, or it won't work

I have no idea why :/

New edit:

You can include ALL the script in the main frame!

Just put:

onEnterFrame = function(){
CAM = new VCam(instance1)
CAM.Follow(instance1,instance2)
}


Posted by B1KMusic - July 27th, 2011


The following is a complete and total, as BomToons calls it, Nerdgasm, so if you don't use flash, or don't know what this is about, I suggest you turn away before your head explodes :D

This script was made in AS2, but it works in AS3, just as long as you change the code a bit.

The following code makes this flash movie tick, it saves two .SOL files on your computer, one called "Level" and the other called "Meta", as in information not seen by mortal eyes.

An object called "s" contains both shared objects, and acts as the key listener

an object called "ad" (Bottom of flash movie) is the object that gives info on where you can find the font (courtesy of me BTW, I spent 4 tireless hours working with that damn site drawing that font) M is an invisible white circle in the movie.

Controls:

+ adds to level
- takes away a level, in case you're sadistic

S prompts a Save
L prompts a Load
D prompts a Deletion

Y accepts prompts
N denies prompts

The following script goes into the frame:

ad._alpha = 0;
M._visible = false;
ad.onEnterFrame = function() {
ACX.FollowMouse(M);
if (M.hitTest(ad)) {
if (ad._alpha<100) {
ad._alpha += 25;
}
} else {
//if No hitTest
if (ad._alpha>0) {
ad._alpha -= 10;
}
}
};
//end info script
//START THE REST
var s = new Object();
s.L = SharedObject.getLocal("Level");
s.M = SharedObject.getLocal("Meta");
var Lvl = 0;
if (s.M.data.fileExists == true) {
savex.text = "Welcome Back, you can Continue your previous file by pressing \'L\'";
} else {
savex.text = "Welcome to the game, Press \'+\' or \'-\' to change level; you can save with \'S\' and delete with \'D\'";
}
function Save() {
s.L.data.Level = Lvl;
s.L.flush();
s.M.data.fileExists = true;
s.M.flush();
}
function Load() {
Lvl = s.L.data.Level;
}
function Delete() {
s.M.clear();
s.L.clear();
}
s.onKeyDown = function() {
KEY = Key.getCode();
if (KEY == key.PLUS) {
Lvl++;
savex.text = "Level: "+Lvl;
} else if (KEY == key.MIN) {
Lvl--;
savex.text = "Level: "+Lvl;
}//END LEVEL CHANGE
if (KEY == key.S) {
SP = true;
DP = false;
LP = false;
savex.text = "Save?";
} else if (KEY == key.D) {
DP = true;
SP = false;
LP = false;
savex.text = "Delete?";
} else if (KEY == key.L) {
LP = true;
SP = false;
DP = false;
savex.text = "Load?";
}//END SAVE, DELETE, and LOAD
if (SP == true || DP == true || LP == true) {
P = true;
}
//END PROMPT SCRIPT
if (KEY == key.Y) {
if (SP == true) {
SP = false;
P = false;
savex.text = "Saving . . . ";
Save();
if (!s.L.flush() || !s.M.flush()) {
savex.text = "Save Failed";
} else {
savex.text = "Save Successful";
}//END Y SAVE
} else if (DP == true) {
DP = false;
P = false;
savex.text = "Deleting . . . ";
Delete();
savex.text = "Delete Successful";
//END Y DELETE
} else if (LP == true) {
LP = false;
savex.text = "Loading . . . ";
if (!s.M.data.fileExists) {
s.M.data.fileExists = false;
savex.text = "No Save File Exists, Load Failed";
} else {
Load();
savex.text = "Load Successful";
}//END Y LOAD
}
//END Y
} else if (KEY == key.N && P == true) {
SP = false;
DP = false;
LP = false;
P = false;
savex.text = "Action Canceled";
}//END N
};
Key.addListener(s);

ACX.FollowMouse is part of a huge (400+ lines) Object Manipulating Class I made called "ACX". Here is the code for it, which you can't use in the frame, it must be in a seperate AS file

"key.S", "key.L" etc. are part of a class called "key", which is in a previous post

class ACX{
static function FollowMouse(obj, vis) {
var vis;
obj._x = _xmouse;
obj._y = _ymouse;
if (vis == false) {
Mouse.hide();
} else {
//reaching the conclusion of else means vis is true or undefined, so it can be left blank
Mouse.show();
}//ERROR CONSOLE (needs "m" and "ms" to work, comment if you want the code for some weird reason)
/*if (!obj) {
APICruft.objerr();
m("Tag: Mouse");
ms("obj: "+obj, "vis: "+vis);
}*/
}
}

Any questions, just comment. If the question is about why I posted this, the answer is 'Fuck off, I was bored.'


Posted by B1KMusic - July 21st, 2011


//-----Save test basic
//-----var save = SharedObject.getLocal("STB", "SB_saves");
//-----above disabled code generates a save error, and this is what forces a trace of "save failed"
var save = SharedObject.getLocal("STB");
//-----creates a variable, creates a Shared object (.SOL file) named STB
// SOL files are located in (Windows 7) C:\User\*username*\AppData\Roaming\Mac romedia\Flash Player\#SharedObjects
//Appdata is a hidden folder, so you must access it by directly editing the address
//
_global.Level = save.data.L;
_global.Lock = save.data.Lock;
if (save.data.L == undefined) {
_global.Level = 0;
}
if (save.data.Lock == undefined) {
_global.Lock = false;
}
//-----loads the .SOL file
var templock = false;
if (_global.Lock == false) {
_global.Lock = true;
world.text = ("Hello and welcome, this must be your first run (or you deleted the file) press \'+\' to increase your level, \'-\' to decrease, and \'S\', \'R\', or \'D\' to Save Reset or Delete respectively. When prompted, press \'Y\' or \'N\', and if you like, \'?\'");
} else if (_global.Lock == true && templock == false) {
templock = true;
world.text = ("Welcome Back");
}
//creates the welcome greeting, which wither gives a first timer welcome, or says welcome back

var OBJ = new Object();
OBJ.onKeyDown = function() {
KEY = Key.getCode();
//
//Level change and trace
// for the next part, make sure that you have downloaded key.as from my previous post
if (KEY == key.PLUS) {
_global.Level++;
tracelock = false;
} else if (KEY == key.MIN) {
_global.Level--;
tracelock = false;
}
if (tracelock == false) {
tracelock = true;
world.text = ("Level: "+_global.Level);
}
//
//end Level change and trace
//
//Save/Delete
//
if (KEY == key.S) {
SP = true;
DP = false
RP = false
//Save Prompt
world.text = ("Save?");
} else if (KEY == key.D) {
DP = true;
SP = false
RP = false
//Delete Prompt
world.text = ("Delete?");
} else if (KEY == key.R) {
RP = true;
DP = false
SP = false
//Reset Prompt
world.text = ("Reset?");
}
if (KEY == key.Y) {
if (DP == true) {
DP = false;
var DPT = 0;
world.text = ("Deleting . . . ");
Delete();
world.text = ("Delete Successful");
} else if (SP == true) {
SP = false;
world.text = ("Saving . . . ");
Save();
if (!save.flush()) {
world.text = ("Save Failed");
} else {
world.text = ("Save Successful");
}
} else if (RP == true) {
RP = false;
world.text = ("Resetting . . . ");
Reset();
world.text = ("Reset Successful");
}
} else if (KEY == key.N) {
if (DP == true) {
DP = false;
world.text = ("Delete Canceled");
} else if (SP == true) {
SP = false;
world.text = ("Save Canceled");
} else if (RP == true) {
RP = false;
world.text = ("Reset Canceled");
}
} else if (KEY == key.QUEMAR) {
//QUEstion MARk, see key.as
if (DP == true) {
DP = false;
world.text = ("\'Delete\' Deletes the .SOL file containing the information");
} else if (SP == true) {
SP = false;
world.text = ("Are you serious? You don\'t know what \'saving\' is? There's no help for you! >:C");
} else if (RP == true) {
RP = false;
world.text = ("\'Reset\' essentially does the same thing as delete, except that it doesn't delete the file, it just resets everything.");
}
}
//End Save/Delete
};
Key.addListener(OBJ);
function Save() {
save.data.L = _global.Level;
save.data.Lock = _global.Lock;
save.flush();
//saves/creates SOL file
}
function Reset() {
save.data.L = 0;
save.flush();
//resets Level, but not welcome boolean
}
function Delete() {
save.clear();
//deletes everything
}

Take the above script (should work in AS3, but AS2 is recommended) and paste it into the frame's AS panel of a movie, then create a dynamic text field with instance name "world"

When you start up the flash movie, it should work just like this

Press F5, and don't comment on the quirks in the save/delete area, I know there is one unused variable "DPT" and extra text that will never show, this is because this used to run on the trace console, so everything was printed out

I post this because I notice the lack of saving tutorials in flash stuff and whatnot

Now enjoy some music


Posted by B1KMusic - July 5th, 2011


key class

This is a .flp file containing actionscript defining a class that expands on Key.whatever

Basically, integrating this into your flash will make it so you don't have to type 65 to get A, and you now can just type 'key.A'

The instructions are crystal clear, and if you have any questions, feel free to comment.

Cam Class

This is a .flp (AS2 only) that makes creating a flash camera as easy as typing 'Cam.Create(this)'

Questions/comments - feel free

This will make so many lives easier!


Posted by B1KMusic - July 4th, 2011


I found out how to stop flash from putting an EXTREME lowpass on sound files!

1: Right click the sound from the library

2: Click Properties

3: click advanced

4: set compression to raw

Setting compression to mp3 or default is the problem, the text under the sampling rate will even read "1.1% of original", which means it will sound like shit

5: set sampling rate to 44

the default is, for some reason, set to 22khz, which is muffled

6: uncheck the "convert to mono" box (optional, keeping it checked will limit it to 50%, but it will still sound decent)

The text under the sampling rate should now say "100% of original"

7: Use sound under 'Start', not 'event' or 'stream,' these put a low-pass on it

And boom, the sound is Clear as Judge Perry's 40 minute reading of the Jury's Instructions

Holy shit