You need a Grounds Gold Account to post on the NG BBS! If you don't have one, click here to sign up now! It's fast, free, and easy — and opens up tons of great NG features!

Author Search Results: 'shazwoogle'

We found 2,681 matches.


<< < > >>

Viewing 1-30 of 2,681 matches. 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 94990

1.

None

Topic: Rookie

Posted: 11/23/09 07:51 AM

Forum: Flash

Sight... Get used to reading thats the best bit of advice anyone can give you. There is LOAADDSS of documentation for flash you just have to read. Not only is the community quiet large but adobe itself have made one of the best help documentation for any product I have ever used.


2.

None

Topic: Full Screen Mode?

Posted: 11/23/09 03:10 AM

Forum: Flash

The hosting website/environment has to allow full screen. And then its fscommand() go google it.


3.

None

Topic: Finding sites that stole your flash

Posted: 11/23/09 03:07 AM

Forum: Flash

At 11/22/09 05:38 PM, LordAdon wrote: this sounds like a job 4 the A-TEAM

They way I would track your swf, is have a socket connection which you pass the data like the URL of the hosted site each time someone loads your movie. You could even have a list of supported sites which the server checks and returns a whether that site has permission to use your swf. You could also do some cool stuff like a have a real count of every time your swf has been loaded as well as with a bit of dicking about I sure you could even get the number of unique hits.


4.

None

Topic: Binary Search Tree implementation

Posted: 11/23/09 02:58 AM

Forum: Flash

At 11/22/09 06:03 AM, dELtaluca wrote: Why don't you just do balanced insertion/deletion?

Reveal your secrets!

I'm afraid i was some what sleeping through my Data structures and Algorithms lecture when they discussed BSTs... Only picked up what I know from a tut and my tutor didn't even speak english. Well she did but it was barley any more than crap conversational english.


5.

None

Topic: Binary Search Tree implementation

Posted: 11/22/09 02:38 AM

Forum: Flash

At 11/22/09 02:24 AM, Fulcrum-Shift wrote: looks complicated
and my attention span just34rtegd0ijfnmkps3rdhgjhkjliuy6t57y

Lol its all really rather simple, you the VAST majority of all that is code anyway.

But I just realized its only O log N when yhou have random data... If you have sequential data it becomes a linked list....

To combat this you could add a sorting algorithm at addition time. or rather a more complex sorting algorithm which would balance the tree...


6.

None

Topic: Binary Search Tree implementation

Posted: 11/22/09 02:21 AM

Forum: Flash

At 11/20/09 07:47 PM, CaptinChu wrote: I just had a progasm.

- O(log2(n))... IN BED!!

Both O Log N in look up reading and writing from memoery. Very nice indeed.

I also noticed a small error, I need to decrease _count every time I pop left or right


7.

None

Topic: Binary Search Tree implementation

Posted: 11/20/09 07:43 PM

Forum: Flash

Hey NG, been a long time...

Anyway, I recently have been working with flash which is something I haven't done for years. But my task required me to store and retrieve a lot of data FAST. So naturally I slapped everything into an Array! But that just didn't have the performance I needed >:( So I asked the question, what data structure would be best? And the answer was a Binary Search Tree.

Well I thought that, this would be a common data structure as it is with nearly every other language. BUT Adobe in there infinite wisdom decided that a BST was unnecessary. But worse still! Not even the internet had an implementation for a BST in AS! This was a terrible blow to me, it meant that I would actually have to sit and type... So I smashed out a big can of V down and two hours later I had this:

BSTNode, more or less just a structure. I only really used this to fool FlashDevelopsintelisense.

package src.col 
{
	/**
	 * @author William Fagerstrom
	 * 
	 * 11/21/2009
	 */
	class BSTNode
	{
		public var data:*;
		public var left:BSTNode;
		public var right:BSTNode;
		public var parent:BSTNode;
	}
}

and Here is the BST implementation.

package src.col 
{
	import src.col.BSTNode;

	public class BinarySearchTree 
	{
		private var root:BSTNode;
		private var _count:int = 0;

		/**
		 * Number of elements in BST.
		 */
		public function get count():int
		{
			return _count;
		}

		/**
		 * Adds a new element to the tree.
		 * @param	data Object to be added
		 * @param	on The field to add data on. i.e. 'x' for a movieclip would sort the tree on the x position.
		 */
		public function add(data:Object, on:String):void
		{
			var c:BSTNode;
			var parent:BSTNode;

			if (root == null)
			{
				root = new BSTNode();

				_assignData(data, root, root);
			}
			else
			{				
				c = root;

				while (c.data != undefined) // Find location to add node
				{
					if (data == c.data)
					{
						return;
					}

					if (c.data[on] > data[on])
					{
						c = c.left;
					}
					else
					{
						c = c.right;
					}
					parent = c.parent;
				}

				_assignData(data, c, parent);
			}

			_count++;
		}

		private function _assignData(data:*, node:BSTNode, parent:BSTNode)
		{
			node.data = data;
			node.parent = parent;
			node.left = new BSTNode();
			node.right = new BSTNode();
			node.right.parent = node;
			node.left.parent = node;
		}

		private function _search(data:*, on:String):BSTNode
		{
			var c:BSTNode = root;

			while (c != null)
			{
				if (c.data[on] == data[on])
				{
					break;
				}

				if (c.data[on] > data[on])
				{
					c = c.left;
				}
				else
				{
					c = c.right;
				}
			}

			return c;
		}

		/**
		 * returns an object from the tree
		 * 
		 * @param	value value is the value of the 'on' fields you wish to find.
		 * @param	on field name
		 * @return
		 */
		public function search(value:*, on:String):*
		{
			var data:Object = new Object();
			data[on] = value;

			return _search(data, on).data;
		}

		private function _remove(c:BSTNode)
		{
			var temp:BSTNode;
			var tmp:*;

			// Check is leaf, a leaf has NO children/Sub trees.
			if (c.left.data == undefined && c.right.data == undefined)
			{
				c.data = undefined;
				c.left = null;
				c.right = null;
				return true;
			}

			// Check is a stem, a stem is when the node has only 1 child/sub tree

			if (c.left.data == undefined && c.right.data != undefined)
			{
				c.data = c.right.data;
				c.right = c.right.right;
				return true;
			}

			if (c.left.data != undefined && c.right.data == undefined)
			{
				c.data = c.left.data;
				c.left = c.left.left;
				return true;
			}

			// If not above then is a tree, remove by going to the left most leaf down the right tree or right most down the left tree
			
			if(_count % 2 == 0)
			{
				temp = c.left;
				
				while (temp.right.data != undefined)
				{
					temp = temp.right;
				}

				tmp = c.data;

				c.data = temp.data;
				c.left = temp.left;
				c.right = temp.right;
			}
			else
			{
				temp = c.right;
				
				while (temp.left.data != undefined)
				{
					temp = temp.left;
				}

				tmp = c.data;
				
				c.data = temp.data;
				c.left = temp.left;
				c.right = temp.right;
			}
		}

		/**
		 * Remove an element from the Tree
		 * @param	data object to find
		 * @param	on Field to sort/search by
		 * @return  Returns false if no object was removed, true if object was removed.
		 */
		public function remove(data:Object, on:String):Boolean
		{
			// find node to remove
			var c:BSTNode = _search(data, on);

			if(c == null)
			{
				return false;
			}

			_remove(c);

			_count--;

			return true;
		}
		
		/**
		 * Pops the left most element. Therefore returns the element with the lowest 'on' value.
		 * @param	on field to search on
		 * @return returns element removed
		 */
		public function pop_left(on:String):*
		{
			if (root.data == null)
			{
				return null;
			}
			
			var c:BSTNode = root;
			var d:*;
			
			while (c.left.data != undefined)
			{
				c = c.left;
			}
			
			d = c.data;
			_remove(c);
			
			return d;
		}
		/**
		 * Pops the right most element. Therefore returns the element with the highest 'on' value.
		 * @param	on field to search on
		 * @return returns element removed
		 */
		public function pop_right(on:String):*
		{
			if (root.data == null)
			{
				return null;
			}
			
			var c:BSTNode = root;
			var d:*;
			
			while (c.right.data != undefined)
			{
				c = c.right;
			}
			
			d = c.data;
			_remove(c);
			
			return d;
		}
	}
}

For those of you interested this is quickly how a BST works.
Data is stored in a two way tree structure (hence binary). Simply means that each element in the tree has two subelements called 'left' and 'right'.

The tree is sorted on a value, this allows for O log N lookup times and the sorting is done at the addition times so there aren't any large sorting patterns. How it sorts the data is this; when adding an element if the value of the sorting field is less than the current element in the tree move down the left side of the element. Move right if the value is greater. Repeat this until you find an empty spot in the tree.

Searching is simple, look down the left hand side if the value is less, right of value is greater until the element you are searching for is found or you run out of elements to search.

Removing is a little more complex simply because there are 3 parts to it.

You can only remove elements which have none or one sub trees. i.e.
If the element you want to remove is a 'leaf' which means it has no sub trees you can simply delete it with out removing other elements in the tree.

if the element you want to remove is a 'stem', which means it has one sub tree, you can just delete it. Doing that you would lose more data than just the element you wish to remove. So you can 'link over' the element you wish to remove. Such that the parent of element you wish to remove needs to link to the one sub tree your deleting element has. I am sure there is a better way of describing this.

If the element you wish to remove is a tree, mean it has two sub elements. You have to swap the element to the bottom of the list. to do this and keep all you data valid you move the element to the left most leaf of the right tree or right most of the left tree. Its also a good idea when removing to swap between removing on the left and right side as doing only on can give you tree a biest. Such that searching for a node of the right might take a lot longer if you only remove from the left.

I made a BST because I needed to get the lowest element out of a 'list' as fast as I can which is why I have implemented pop_left. It just finds the left most element which is the element with the smallest value.

The 'on' field in the methods is there because AS doesn't allow overloading of operators. This just allows me to add different types of objects to the tree.

There now no one need to type this out a BST again


8.

None

Topic: The Flash 'Reg' Lounge

Posted: 05/04/09 07:00 PM

Forum: Flash

At 5/4/09 06:55 PM, AdamJack wrote: Man. I can't be bothered to do anything anymore. What do people do to stay active?

Get a mate to help you on a project. Someone you know in real life. Helps me heaps.


9.

None

Topic: As3 Code

Posted: 05/04/09 07:00 PM

Forum: Flash

Whats your character class? If you are getting no errors then it is working. Though it mightn't be working how you expected. Please state exactly what happens and what you want to happen.


10.

None

Topic: Hello, odd error... Help please?

Posted: 04/17/09 08:52 AM

Forum: Flash

Still no solution...


11.

None

Topic: Hello, odd error... Help please?

Posted: 04/16/09 04:37 AM

Forum: Flash

Doesn't work how I want it to work. An if statment will make it all jumpy at best.


12.

None

Topic: Hello, odd error... Help please?

Posted: 04/16/09 02:41 AM

Forum: Flash

I am checking using a hitTestPoint, with shape flag set to true... By all rights this should be working, right?


13.

None

Topic: Hello, odd error... Help please?

Posted: 04/16/09 01:51 AM

Forum: Flash

Example of problem.

Why is it jumping like that?

Here is my code:

var s:Number = 0

function enterFrame(e:Event):void
{
	ground.y -= s;
	s += 1.2
	
	while(ground.hitTestPoint(player.x, player.y, true))
	{
		ground.y++
		s = 0		
	}
}

addEventListener(Event.ENTER_FRAME, enterFrame);

14.

None

Topic: Need some flash help =[ sepereatlyr

Posted: 02/04/09 04:40 PM

Forum: Flash

Add an ENTER_FRAME event to you Zombie, then in there get it to move/make desicions.


15.

Elated

Topic: AS3.0 Colour picker

Posted: 02/04/09 01:17 AM

Forum: Flash

At 2/4/09 01:05 AM, AdairTishler wrote: if I ever decide to use it, I'll be sure to credit you

Awesome thanks :D


16.

None

Topic: Help Me Please

Posted: 02/04/09 12:58 AM

Forum: Flash

As:Main

As3:Main

They will help you.


17.

None

Topic: AS3.0 Colour picker

Posted: 02/04/09 12:54 AM

Forum: Flash

No comments I'm depressed :'(

Does anyone even use AS3.0 here? I was reading some of the posts here (Its been a while since I have) and it seems people are still using 2.0. What I really want to know is why? Is it the lack of documentation/tutorials/Open source? Or somthing else?


18.

Resigned

Topic: AS3.0 Colour picker

Posted: 02/03/09 06:56 PM

Forum: Flash

Well though absence of a free AS3.0 colour picker componet I decided to make my own. Its not mathematicaly perfect but it gets the job done.

package {
	import flash.display.Sprite;
	import flash.display.Bitmap;
	import flash.display.BitmapData;
	import flash.display.GradientType;
	import flash.events.MouseEvent;
	import flash.geom.Matrix;
	import flash.display.SpreadMethod;
	import flash.display.BlendMode
	import flash.geom.Point
	import flash.geom.Rectangle
	import flash.text.TextField;
	import fl.motion.Color
	
	public class ColourPicker extends Sprite {
		private var bmp:Bitmap = new Bitmap();
		private var img:Sprite = new Sprite();
		private var img2:Sprite = new Sprite();
		private var colourDisplay:Sprite = new Sprite();
		private var colourHex:uint = 0xFFFFFF
		private var mouseDown:Boolean = false;
		private var txtHex:TextField = new TextField()
		private var bmpBrightness:Bitmap = new Bitmap();
		private var colourBoard:Sprite = new Sprite();
		private var brightnessContainer:Sprite = new Sprite();
		private var arrow:Sprite = new Sprite();
		private var colourBreaker:Color = new Color(); // Quick and easy breakdown of colour hex

		public function ColourPicker() {
                               // Gradient of colour spectrum
			var fillType:String=GradientType.LINEAR;
			var colors:Array=[0xFF0000,0xFFFF00,0x00FF00,0x00FFFF,0x0000FF,0xFF00FF,0xFF0000];
			var alphas:Array=[1,1,1,1,1,1,1];
			var ratios:Array=[0,43,85,128,171,213,255];
			var matr:Matrix = new Matrix();
			
			matr.createGradientBox(100, 100, 0, 0, 0);
			var spreadMethod:String = SpreadMethod.PAD;
			
			img.graphics.beginGradientFill(fillType, colors, alphas, ratios, matr, spreadMethod);
			
			img.graphics.drawRect(0,0,100,100);
			img.graphics.endFill()

			// brightness gradient for main display
			matr.rotate(Math.PI/2)			
			img2.graphics.beginGradientFill(fillType, [0xFFFFFF, 0xFFFFFF, 0x0, 0x0],[1, 0, 0,1],[0, 127,129,255], matr);
			img2.graphics.drawRect(0,0,100,100);
			img2.graphics.endFill()
			
                         // Draw gradients to bitmap
			bmp.bitmapData = new BitmapData(100,100, true, 0xFF000000);
			bmp.bitmapData.draw(img,null,null,BlendMode.NORMAL)
			bmp.bitmapData.draw(img2,null,null, BlendMode.NORMAL)			
			
			colourDisplay.graphics.lineStyle(1);
			colourDisplay.graphics.drawRect(0,0,20,20);
			colourDisplay.y = bmp.height + 5;
			
			txtHex.border = true;
			txtHex.x = colourDisplay.x + colourDisplay.width + 5
			txtHex.y = colourDisplay.y
			txtHex.width = bmp.width - (colourDisplay.width + 5);
			txtHex.height = 20


			// Brightness on selected colour
			img2.graphics.beginGradientFill(fillType, [0xFFFFFF, 0xFFFFFF, 0x0, 0x0], [1, 0, 0, 1], [0, 127, 129, 255], matr)
			bmpBrightness.bitmapData = new BitmapData(10, 100)
			bmpBrightness.bitmapData.fillRect(new Rectangle(0, 0, 10, 100), 0xFFFFFFFF);
			bmpBrightness.bitmapData.draw(img2)
			bmpBrightness.x = bmp.width + 5
			
			arrow.graphics.lineStyle(1);
			arrow.graphics.beginFill(0)
			arrow.graphics.lineTo(4, -2)
			arrow.graphics.lineTo(4, 2)
			arrow.graphics.lineTo(0, 0)
			arrow.x = bmpBrightness.x + bmpBrightness.width + 1
			arrow.y = bmpBrightness.height / 2
			
			
			colourBoard.addChild(bmp);
			brightnessContainer.addChild(bmpBrightness)
			addChild(colourDisplay)
			addChild(colourBoard)
			addChild(txtHex)
			addChild(brightnessContainer)
			addChild(arrow)
			
			colourBoard.addEventListener(MouseEvent.MOUSE_MOVE, colourBoardOnClick);
			addEventListener(MouseEvent.MOUSE_DOWN, colourBoardOnMouseDown)
			addEventListener(MouseEvent.MOUSE_UP, colourBoardOnMouseUp)
			brightnessContainer.addEventListener(MouseEvent.MOUSE_MOVE, brightnessBoardMouseMove)
		}
		
		private function colourBoardOnClick(e:MouseEvent):void {
			if (mouseDown) {
				colourHex = bmp.bitmapData.getPixel(bmp.mouseX, bmp.mouseY);
				txtHex.text = colourHex.toString(16);
				
				bmpBrightness.bitmapData = new BitmapData(10, 100, false, colourHex)
				bmpBrightness.bitmapData.draw(img2)
				
				colourDisplay.graphics.clear()
				colourDisplay.graphics.lineStyle(1);
				colourDisplay.graphics.beginFill(colourHex)
				colourDisplay.graphics.drawRect(0, 0, 20, 20);
				colourDisplay.graphics.endFill()
				
				arrow.y = brightnessContainer.height / 2;
			}
		}
		private function brightnessBoardMouseMove(e:MouseEvent) {
			if (mouseDown) {
				colourHex = bmpBrightness.bitmapData.getPixel(bmpBrightness.mouseX, bmpBrightness.mouseY);
				txtHex.text = colourHex.toString(16);
				
				colourDisplay.graphics.clear()
				colourDisplay.graphics.lineStyle(1);
				colourDisplay.graphics.beginFill(colourHex)
				colourDisplay.graphics.drawRect(0, 0, 20, 20);
				colourDisplay.graphics.endFill()
				
				arrow.y = mouseY
			}
		}
		
		private function colourBoardOnMouseDown(e:MouseEvent):void {
			mouseDown = true;
		}
		private function colourBoardOnMouseUp(e:MouseEvent):void {
			mouseDown = false
		}
		
		public function get colour():uint {
			return colourHex
		}
		
		public function get red():int {
			colourBreaker.color = colourHex
			return colourBreaker.redOffset
		}
		public function get green():int {
			colourBreaker.color = colourHex
			return colourBreaker.greenOffset
		}
		public function get blue():int {
			colourBreaker.color = colourHex
			return colourBreaker.blueOffset
		}
	}
}

I used getters insead of a function because I prefer to use them as a variable (it makes my code look better :P). Though I haven't added any setters to you actualy modify them. This colour picker is also scalable but I haven't added that in yet, just change the size of bmp's bitmapData and the size of the gradient fills.

Have fun people. [LINK]


19.

None

Topic: OOP help?

Posted: 12/21/08 06:40 PM

Forum: Flash

OMG! I am about to cry.

That is the funniest mistake I think I have ever made, The ammount of times I have looked over that.


20.

None

Topic: OOP help?

Posted: 12/21/08 05:50 PM

Forum: Flash

At 12/21/08 04:25 AM, Calipe wrote: Have you checked if you have specified the class path in Flash's settings?

Done that.

At 12/21/08 10:43 AM, knugen wrote: Are you folders set up right? From what I can tell it should be something like this:

Main Folder
- YourFLA.fla
- src Folder
- - objects Folder
- - - Square.as

That is correct, that is what I have done.

http://www.mediafire.com/?5r5mxjjz2by - I have ziped the directory, can someone point out to me what is wrong?


21.

None

Topic: OOP help?

Posted: 12/21/08 02:56 AM

Forum: Flash

But its not, I get an error when I try to use import src.objects.Square I get this error: "1172: Definition src.objects could not be found."


22.

None

Topic: OOP help?

Posted: 12/20/08 01:26 AM

Forum: Flash

Hello people I have a silly problem I know will be easy to fix. But I usualy use FlashDevelop to mke my projects.

Anyway I want to include some classes from a subdirectory of my class library. In flash develop is simply use this:

import src.objects.Square;

and my class package is obviously

package scr.objects

This all works in FlashDevelop but not it in the flash IDE!
Can you help me please? How do I import classes from a subdirectory?


23.

None

Topic: real 3d objects in cs4!

Posted: 12/13/08 09:14 PM

Forum: Flash

This is old news... Also CS4 can't do real 3d it has no Z Buffer. Though it can give the illusion very well which is all that is needed. But for complex scenes is a bit of a dog.


24.

None

Topic: Mouse Movement Area?

Posted: 12/13/08 09:06 PM

Forum: Flash

Effeciency, hitTest consume CPU in comparison to a few boolean statments like this:

if(_xmouse > 0 && _xmouse < 100 && _ymouse >0 && _ymouse<100){
startDrag()
}else{
stopDrag()
}

Orsomthing like that, though draging isn't always the best option either... Have you though about setting the _x and _y coords to _xmouse and _ymouse instead?


25.

None

Topic: Arrays in my sich-a-ma-gation. ..

Posted: 12/13/08 09:02 PM

Forum: Flash

var acheivments:Array = new Array();

acheivments[0] = 1
acheivment[1] = 0
acheivment[2] = 0

trace(acheivments)
trace(acheivments[0])
trace(acheivments[1])

Thats more or less what your after?

Think of an array like a numerical list (Which starts counting at 0)


26.

Angry

Topic: The Flash 'Reg' Lounge

Posted: 11/15/08 11:04 PM

Forum: Flash

I am raging right now! Did you know AS3.0 can't overload functions!!! You have to do an internal type check which makes my code look messy.

Anyone else feel my rage.


27.

None

Topic: Flash helper wanted

Posted: 11/13/08 10:37 PM

Forum: Flash

add me on MSN: williamf03@gmail.com I have been using flash for a good 6 years now, I'll help how ever I can.


28.

None

Topic: Flash CS3

Posted: 11/07/08 08:03 PM

Forum: Flash


29.

None

Topic: static effect

Posted: 11/04/08 01:20 AM

Forum: Flash

In flash CS4 their is a 'common library' of Audio with a static sound in it. Go Window > Common Library > Sounds


30.

None

Topic: if you were roo what would you do?

Posted: 11/04/08 01:17 AM

Forum: Flash

At 11/3/08 08:08 PM, chickendance333 wrote: I would kill all those fucking tourists.

Second that.

To the dude who was like: "Attack the Koalas" I say this:

Don't attack Koalas, Koalas are cool they sit in their trees all day drunk. They're like: "Nah its cool brah, just chill". Their is alcohol in Eucalyptus leaves.

Coincidently there is a Koala out my window right now, being drunk in a tree.

But for Kangaroos on a killing spree, massive jump and massive kick. Disembouling kick


All times are Eastern Standard Time (GMT -5) | Current Time: 01:13 PM

<< < > >>

Viewing 1-30 of 2,681 matches. 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 94990