Monday, September 22, 2008

216 HEX COLOR ARRAY

hexArray = new Array("000000", "000033", "000066", "000099", "0000CC", "0000FF", "003300", "003333", "003366",
"003399", "0033CC", "0033FF", "006600", "006633", "006666", "006699", "0066CC", "0066FF", "009900", "009933",
"009966", "009999", "0099CC", "0099FF", "00CC00", "00CC33", "00CC66", "00CC99", "00CCCC", "00CCFF", "00FF00",
"00FF33", "00FF66", "00FF99", "00FFCC", "00FFFF", "330000", "330033", "330066", "330099", "3300CC", "3300FF",
"333300", "333333", "333366", "333399", "3333CC", "3333FF", "336600", "336633", "336666", "336699", "3366CC",
"3366FF", "339900", "339933", "339966", "339999", "3399CC", "3399FF", "33CC00", "33CC33", "33CC66", "33CC99",
"33CCCC", "33CCFF", "33FF00", "33FF33", "33FF66", "33FF99", "33FFCC", "33FFFF", "660000", "660033", "660066",
"660099", "6600CC", "6600FF", "663300", "663333", "663366", "663399", "6633CC", "6633FF", "666600", "666633",
"666666", "666699", "6666CC", "6666FF", "669900", "669933", "669966", "669999", "6699CC", "6699FF", "66CC00",
"66CC33", "66CC66", "66CC99", "66CCCC", "66CCFF", "66FF00", "66FF33", "66FF66", "66FF99", "66FFCC", "66FFFF",
"990000", "990033", "990066", "990099", "9900CC", "9900FF", "993300", "993333", "993366", "993399", "9933CC",
"9933FF", "996600", "996633", "996666", "996699", "9966CC", "9966FF", "999900", "999933", "999966", "999999",
"9999CC", "9999FF", "99CC00", "99CC33", "99CC66", "99CC99", "99CCCC", "99CCFF", "99FF00", "99FF33", "99FF66",
"99FF99", "99FFCC", "99FFFF", "CC0000", "CC0033", "CC0066", "CC0099", "CC00CC", "CC00FF", "CC3300", "CC3333",
"CC3366", "CC3399", "CC33CC", "CC33FF", "CC6600", "CC6633", "CC6666", "CC6699", "CC66CC", "CC66FF", "CC9900",
"CC9933", "CC9966", "CC9999", "CC99CC", "CC99FF", "CCCC00", "CCCC33", "CCCC66", "CCCC99", "CCCCCC", "CCCCFF",
"CCFF00", "CCFF33", "CCFF66", "CCFF99", "CCFFCC", "CCFFFF", "FF0000", "FF0033", "FF0066", "FF0099", "FF00CC",
"FF00FF", "FF3300", "FF3333", "FF3366", "FF3399", "FF33CC", "FF33FF", "FF6600", "FF6633", "FF6666", "FF6699",
"FF66CC", "FF66FF", "FF9900", "FF9933", "FF9966", "FF9999", "FF99CC", "FF99FF", "FFCC00", "FFCC33", "FFCC66",
"FFCC99", "FFCCCC", "FFCCFF", "FFFF00", "FFFF33", "FFFF66", "FFFF99", "FFFFCC", "FFFFFF");

Sunday, September 7, 2008

5 Awesome Javascript Effects -- WBP

For some reason I am having extreme internet complications. So I cant load any web pages, hurray! Nah Really though, I need to put a pass on the wifi asap!

Browsing around on the net I found some dope things!!!

http://blog.nihilogic.dk/

This dude here is a Javascript Master!
Hes doing things, that should be considered straight voodoo!

But check it out. Super Dope!




1. Image zooom!



URL: http://www.nihilogic.dk/labs/mojomagnify/

I tried this, its pretty complicated. Super advanced. It looks like allot of functions triggered with variables that are placed as methods in other functions. Its crazy!!!

2. Mario Cart (GOODNESS!)



http://blog.nihilogic.dk/2008/05/javascript-super-mario-kart.html


This is super dope. I have no idea or want to know how this is done!

3. 14k mario Bros...



http://blog.nihilogic.dk/2008/04/super-mario-in-14kb-javascript.html


I hate this guy!!!

4. HURRAY I FINALY FOUND AN AWESOME EXAMPLE OF A PARTICLE SYSTEM



http://www.nihilogic.dk/labs/particles/

Dope. this is awsome cause it has a user definalbe widget that lets you modify the particles. Awesome, I want to get more into particle systems with flash. This may be an awesome example of in Javaskript!


5. JQuery
Whoo, whats easier than using someone else's code. Using a library of some one else's code. WHOOOOOO
Instead of having to write all these fast fun easy javascript effects, you can reference jquery. And it will save your life. Whoooo

http://jquery.com/

Jquery is pretty cool actually. I use it as a reference tool, by looking at how something could be achieved, and is accomplished in jquery.
Since jquery depends on classes and id's of the html document. All the effects are visualy pleasing, and most of them you can control fairly simple.
Check check check...

Tuesday, August 19, 2008

Date Object! --- WBP

okay to start off, the date object is pretty cool to use. The only thing I don't like, is that it is only as in depth as numbers. If you want to define anything any other way, you need to build an array or two. Which don't get me wrong, this could be very useful, but is very tedious.

Lets get started.
1.Wed Sept 10 00:00:00 PDT 2007
This was easy, basically create a new date and alert it.
var myDate = new Date();
alert(myDate)

you will need the myDate variable to accomplish each question


2.9/15/2007
In order to do this, you need to use a couple methods from the date object.
I used
getMonth
getDate
and getFullYear


Create variables for each of these that distract the value from the entire date.
an ex.

var day = myDate.getDate()
var month = myDate.getMonth();
var year= myDate.getFullYear();

then alert those in a sequence.
document.write(month + "/" + day + "/" + year);

3.
February 10, 2007
This question is wak, basically you have to create an array to hold each month.
Then you want to use the index number to pull which month it is from the array.

var monthArray=new Array(12);
//Create an Array to hold all strings of months of year
monthArray[0]="January";
monthArray[1]="Febuary";
monthArray[2]="March";
.....
var m = myDate.getMonth();
document.write(monthArray[m] + " " + day + ", " + year);
To write the string properly you need to build the string using the same concept as the last question

4.
Output today’s date in this format: Monday, October 15, 2007
This concept is exactly the same. You need to build an array for the days of the week, and the month. The only trick is to use the getDay method to get the number of the day in the month, rather than the getDate the day of the week. :D
good Luck!

5.Output the time in this format: 11:30:03 AM

Heres another fun fun tedious ass time thing blah!
easy enough though this holds all the exact same concepts as the last ones. Except you use the
getHours
getMinutes
getSeconds methods
also, to be fancy I created a little conditional statement to display the AM or PM
I started out by finding out what that means.
Meridiem its latin! crazy
then i wrote a conditional statement that takes the hour of the day and sees if its before or after 12. noon.


//Define meridiem of day
var meridiem = String;
if(hour <= 11){
meridiem = " AM";
} else {
meridiem = " PM";
}


Then document. write your string. Easy as that

The other questions were over my head. :D
comments comments...

Monday, August 18, 2008

Midterm Intermediate -- Authoring

Alright, alright. I took a vacation, kill me.
Nah actually im coming to realize the term burnt out is really a verb not a suggestion. Im tired, basically too much work and school. Blah, im done, i finish. haha nah, lets get back to work.

So if you ready the reading for the Midterm in authoring, it explains that the requests are to be made using a Super Class. That combines all the little glamorous things that can be accomplished using the Draw Shape function from the Sprite class.

Well Lets get started, the assigment wants you to draw
1 green circle
1 grey square
1 blue square
and
1 red ellipse

Luckily since we will be accomplishing this all from one class, we dont have to hard code any of these shapes using the draw function. We can put that all into our class.

Lets start by creating a class called
DrawShape

with the hierchy placed in a com folder, in an ai folder. blah blah. yes we know that,
But do you know why we do that?

The reason you imbed your custom classes in deep rooted folders with the names of your company, is to insure your class. If people steal your code, there gonna have to work realy hard to get your company name out of the hierchy. Get it?

Next the class we created has to be a super class extending sprite!
This looks like
public class DrawShape extends Sprite{

Next we are going to create two custom classes, First lets build our circle function.
In our circle function we want to define some perameters

public function drawCircles(
name:String,
fillColor:uint,
strokeWeight:uint,
strokeColor:uint,
xPos:uint,
yPos:uint,
radius:uint)
:void{

Look at all those definitions! Basicaly I wrote out all that I want to be able to assign when building this shape. Next I need to associate my custom properties to variables within the sprite class. So with in my function I start with the fillColor
graphics.beginFill(fillColor)
This is done in the graphics class.
graphics.lineStyle(strokeWeight, strokeColor)
graphics.drawCircle(xPos, yPos, radius);
}

These are all defined in my Function
Looks like this!

public function drawCircles(name:String, fillColor:uint, strokeWeight:uint, strokeColor:uint, xPos:uint, yPos:uint, radius:uint):void{
graphics.beginFill(fillColor)
graphics.lineStyle(strokeWeight, strokeColor)
graphics.drawCircle(xPos, yPos, radius);
}


So now when you call up a drawCircles function you define all your properties!

I create a variable for greenCircle, it is of our DrawShape class and is a New DrawShape
private var greenCircle:DrawShape = new DrawShape;

So then we say what our greenCircle is:
greenCircle.drawCircles("greenCircle", 0x66CC33, 7, 0x336600, 50, 100, 50);
addChild(greenCircle);
//Notice it is in our drawCircles function within our DrawShape class!

See how it works!

See if you can get it to work and draw your other shapes!
The same process is used in the drawRectangle and drawElipse function within our DrawShape class!

NEXT....
I add some listeners to my new shapes!
greenCircle.addEventListener(MouseEvent.CLICK, greenCircleRemover);
redEllipse.addEventListener(MouseEvent.CLICK, greyRecRemove);
blueRectangle.addEventListener(MouseEvent.CLICK, addGreenCirc);
miniGreenCircle.addEventListener(MouseEvent.CLICK, moveUp);

First function:
function greenCircleRemover(e:Event):void{
removeChild(greenCircle);
}
This will remove the child of
greenCircle var!
Get it?

The next one is exactly the same! but you remove the grey rectangle!

Now we say if you cclick our blue rectangle we want to add 10 green circles!

well within our blueRect function we need a for loop that runs 10 times.
Within that loop we want to build a green circle every time it loops.
Lets create the first green circle in a var!
Then we can define what our miniGreenCircle variables is!
miniGreenCircle.drawCircles("miniGreenCircle", 0x66CC33, 2, 0x336600, i * 25, 275, 10);
Then we want to addChild.

Bling that it!

We also want to move those up 10 pixels when they are clicked. Since they are all the instance of
miniGreenCircle, all we need is one function to control that variable!

Then we -= 10 to the y position!
Get that?

Let me know if you got it! COMMENT!
:D



This should add the 10 green circles

Wednesday, August 6, 2008

= == === ??? (WBP Notes)

=
Assigns values

"red" = 2;
"blue" = 1;

alert(1);
//we get red
alert(2);
//we get blue

==
is used to compare values in a condition
does this equal this!

if (1 == "red"){
alert("This is true, we assigned 1 to red");
}

===
is used to make sure that this is exactly true, no ifs and or buts. This better be true!
Checks the input and datatype!
so no matter what 1 has to be 1.
if (1 === 1){
}

}

Saturday, August 2, 2008

DRAFT -- Week 03 HW3 -- WBP *** Ekstra Kredit

Alright. This is a tough one.
We want to ask the user for an input. Then we want to print out every prime number that comes before the userInp.

Hmmm

A prime number is anything that can only be divided by its self, and one.
That means that it can not be cut in half, basicaly.
Which also means, that if it has a Modulo its remainder would be 0. Right?

%2
hmmm.

First. I need to get this userInp.
PROMPT

var userInp = prompt("Yo, Diggidy, Give me a number", "");
Lets parse
var userNum = parseInt(userInp);

Now lets see if our userNum was cut in half, would it cut evenly?

if (userNum % 2 == 0){
prompt("Sorry, this is NOT a prime number!");

} else {
prompt("Yo this IS a prime number!");
}

:D
We know what numbers are. How do we print them out!

*** Pseudo Coding ***
If my number is a prime number, I need to take every other prime number that is less of it, and print it.
So that means, every number that has a % 2 == 0
I want to print.

So someway I need to say that any number that is before userNum, needs to see if it is dividable by two. If it is, print.
!!Also, I need to Loop through each number to see if its modulo is 0.

For loop.
I need to make sure that my 4 loop goes as many times as my User num, so I can get each number before it.

for (aNum = 1;
aNum < userNum; aNum++ ){
}

What do we want to happen.
we want to check the Modulo thing. Well, we already did that in our If Statement.
Lets LOOK! inside our loop and see what happens.
The first line...

if(userNum % 2 ==0){
!!Dont do anything
} else {
//We now want to print!
EVERY NUMBER THAT
Cannt be divided by two and equal zero!

}

if (userNum % 2 == 0){
prompt("Sorry, this is NOT a prime number!");
} else {
prompt("Yo this
IS a prime number!");



Break Time!!!!
I need to think about this a little more!!!

var userInp = prompt("Enter a number.");
var userNum = parseInt(userInp)
for (var aNum = 0; aNum <>
//document.write("blahblah");
if (userNum % 2 == 0){
//document.write(userNum);
alert("Sorry, this is not a correct Prime Number.");
break;
} else if (userNum % 2 != 0){
document.write(aNum + " Is a prime number." + "
");


}
}







Friday, August 1, 2008

Week 03 HW2 -- WBP

Homework assignment two was much easier than than the first one.
The assigment is two create a javascript Guessing number game.

First you need to start out by creating a random number 1-10.
I still am confused how to create a random number 1-10, but I found some documentation on W3Schools that writes like this

var rndNum = (Math.ceil(Math.random()*10));

This will create a random number 1-10 each time.
I suggest you alert your random number to test your guessing game.

You need to give the user 3 tries to guess the random number, and if they do not guess it correct they fail. But if they guess correctly they win!

I started out by creating a for loop that will occur 3 times.
This is simple by saying that 1 < 3 so keep going

for (i = 1; i <= 3; i++){

This will loop 3 times.
Next you need to get the users input and parse it into a number, like in the last assignment.

var userInp = prompt("Please Guess a Number from 1 - 10", "")
var userNum = parseInt(userInp);
//Notice im parsing variable userInp!

You can basically I copied that from HW1

Now we need to check if the UserNum is equal to our random number

Since our random number is in a variable called rndNum we can create a simple if statement that checks to see if userNum is == to rndNum

If (userInp == rndNum) {
then we go ahead and alert, "Hurray you got the correct number.

}
if else (userInp != rndNum){
then we need to say."You didnt guess the correct number"
}


I ran into a tricky position. I kept repeating the for loop 3 times regardless if they one or loss.

I figured out that if they won, I needed to break the for loop.
I did this by using
break;

The only question is...
Where did I put it?

Also, heres something else I added to my Guessing game.
If you get the message "You didn't guess the correct number"
3 Times, you will get a prompt saying that you have "Lost the Game"
How do you think this was done.

a Hint, it involves an if about my variable i


:D


-Franky

Thursday, July 31, 2008

Week 03 HW1 -- WBP

Homework part 1
Was ridiculous. This assignment deffinetly requires you, to think out side of the box!

The assignment is to ask the User to for a Number 1-10.
Then depending on what number they give you, you need to print out a Number pyramid.
So if the user gives you 4
you will print out
1
22
333
4444

And ect... This will go on and on!

The trick to this assignment is to use two for loops.
Start out by prompting the user for a number
Have what ever value they give you, be turned into a variable...

An example of this would be
var userInp = prompt("Please Give me a Number");

Next you need to parse their input into a Real Number value
So the overall is to create a new variable, that takes the users input and parses it into a number!
This can be done by using
parseInt();

var userNum = parseInt(what goes here?);

Next we create a for loop that will count until we reach the userNum

for (var ind= 1; ind <= userNum; ind++){
//In here we document write our ind
document.write(ind);
}

This will print out all the numbers before the user input
So how do we create the pyramid.
This is smartest think about it by using pseudo programming.

We use the same process as our first loop. But we in bed it in our loop. So we create a second for loop.

But we need to place it somewhere. How bout in the first loop.
notice what were conflicting...

for (var ind2= 1; ind2 < ind; ind2++){
document.write(ind);
}

ind vers ind2
This way they can corresponds with each other.

thats it.
Theres one more line to enter and thats
which writes an html break



Figure out where all these lines go, and you completed this weeks first homework assignment!

:D

-Franky

Week 03 Lab3 -- WBP

This lab was tricky at first, then I just had to think about it.
First of all, you need to understand what exactly a "for loop does.

heres the syntax of a for loop

for(initialize the for loop; give it a problem; tell it what it needs to do to fix its problem){

}

initialize the for loop -
You need to turn it on basically. For beginning, its always awesome to create a variable there. Something that usually is a number, that equals 1 or 0.

var aNum=1;

next you need to set a condition this is best when telling this aNum, that its smaller than another number.

aNum <=5;

Next how do we fix this problem, well we just need to + to aNum until it reaches 5
aNum++

This is how it would look.

for(aNum = 1; aNum <= 5; aNum++){
alert("we have looped " + aNum + " time.");
}

All we created was a loop that will run 5 times. See???
For loops are awesome if you want something to repeat several times, hence "loop".
Try it out.


The assignment calls for a document write that outputs.
01234

Basically I just showed you the exact way to do that

for (var aNum = 0; aNum<6; aNum++){
document.write(aNum);
}
This is less than 6 because the number is indexed. 012345??!!

Next we need to document write
1
2
3
4
5


This is trickier but a no brainer. Since we are document writing to an HTML page, we are allowed to use HTML tags as strings. This is awesome, because you could basically build a web page by just using javascript. WTFUNK!!!

for (var aNum = 1; aNum<=5; aNum ++){
document.write(aNum + "?");
}
what html tag do you use to create a break?


Last part
2, 4, 6, 8, 10


Basically this is the exact same thing. except,
we don't want to ++, we probably just want to add 2.
and We don't want to start out with 0 or 1. We probably just want to start with 2.

for (var aNum = 2; aNum <=10: aNum += 2){
//that was easy
// next we Document write
document.write(aNum + "? ");

//what would go there???
// 2, 4, 6, 8, 10



Thats it. For loops are dope! makes things much easier. as for While loops, and DoWhile loops???
Pfft. I have no idea how those work!

:D

Wednesday, July 30, 2008

Week 03 HW3 -- Authoring

Ahh, Classes.
Unfortunetly I do not have the hand out in front of me, and the instructor is smart enough to keep nothing online. But I finished the homework and will do my best to explain whats going on.

To start off we created an Actionscript project.
We created a Custom Class called
InventoryItem

The assigment was to take the "author" value and turn it into its own class, that will contain author information such as. First name, last name, and birth date.

To do this I created a new class called
AuthorInformation

This class contains 3 variables called
private var _nameFirst: String;
private var _nameLast: String;
private var _birthDate: String;

In my public function I give the AuthorInformation the correct String values

public function AuthorInformation(nameFirst:String, nameLast:String, birthDate:String){
_nameFirst = nameFirst;
_nameLast = nameLast;
_birthDate = birthDate;
}

Then I set up a function for each variable that will return my String

public function getAuthorNameFirst():String{
return _nameFirst;
}
public function getAuthorNameLast():String{
return _nameLast;
}
public function getAuthorBirthDate():String{
return _birthDate;
}

}
}

Next In my InventoryItem class, I change author from String to the correct data type.
Which happens to be my New Class!

public class InventoryItem{
private var _quantity:Number;
private var _productName:String;
private var _author:AuthorInformation;

And I make sure that all my _author variables, are of AuthorInformation data type!
Get that?

Great, thats done. Now to actually set values within my AS project.
So

First I create my inventoryItem variable
which is of What DataType???

var author3:AuthorInformation = new AuthorInformation("Allen","Ginsberg","12/25/75");
Now I enter all my Values
nameFirst
nameLast
birthDate

You getting this???

Next I create an inventoryItem Variable, which is of my InventoryItem class
var inventoryItem_3:InventoryItem = new InventoryItem(?,?,?);
Now my values

which are...
private var _quantity:Number;
private var _productName:String;
private var _author:AuthorInformation;
*\Notice that
quanity is a number
productName is a string
and author is...???
of my AuthorInformation Class

So what would my values be
quantity is 225
productName is howl
and my AuthorInformation???
Well I declared all that in a variable called???

var author3:AuthorInformation = new AuthorInformation("Allen","Ginsberg","12/25/75");
var inventoryItem_3:InventoryItem = new InventoryItem(225, "Howl", author3);

You getting this?

Awesome thats it. Its done?! WTFUNK!!!

Lets trace!

trace ("Title: " + inventoryItem_3.getProductName());
trace ("Quantity: " + inventoryItem_3.getQuantity());
trace ("Author First Name: " + inventoryItem_3.getAuthor().getAuthorNameFirst());
trace ("Author Last Name: " + inventoryItem_3.getAuthor().getAuthorNameLast());
trace ("Author Birth Date: " + inventoryItem_3.getAuthor().getAuthorBirthDate());


You will get

Title: Howl
Quantity: 225
Author First Name: Allen
Author Last Name: Ginsberg
Author Birth Date: 12/25/75

TADA!!!
-Franky A.


1st Post

Alrighty Here it is.
Im going to be posting all my Notes and Homework Assignments on this blog.

Why?
Well, first of all, I figure people getting annoyed having to be in class with me. Cause all I do is talk about how I know this stuff already. Basically I want to move on, I hate listening to the teacher explain this stuff over and over, and well that's the joy of school. RIGHT?

What should I do then, I should get off my but and walk around and help people! But I'm lazy, so I figure Ill start a blog with my Assignments and knowledge, hopefully I will Inspire!!!

There will be two Sections in this blog
Javascript and ActionScript 3

The classes I am currently taking are
Intermediate Authoring
and
Intermediate WBP

I will post for each homework Week. My explanation and samples of my HW, hopefully this will help people

PLEASE DO NOT PLAGIARIZE MY WORK.
If you use my blogg, show some funky respect yo!
Don't be an ass!...

Thanks, and peace out!


-Franky