Announcement

Collapse
No announcement yet.

Radiant Virtuoso Q1 Gamepack ver 2.many

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • #61
    it doesn't negate it. Consider this:

    You have 3 objects in a parent object and only one of those is required to have mouse events attached to it. The parent object holds no named reference of these objects so there has to be a system to apply the events in a standalone manner.

    I initiate a mouseDown event listener on the appropriate child. When you mouse down, whatever had the event attached to it then has the Up/Over/Out events attached to it. Understand that this is component specific. The Caption component is the one to make these decisions. There are definitely other ways to handle objects which are mouse interactive but, for this case this is a very clever way.

    Without ever telling the parent - do X to specific.Object or ever even making a specific.Object I get the same functionality as if I built a static element with named children.

    When I explain my button code and how it inherits the same interface but utilizes it differently you'll really get the idea of how my Objects are all concepts. I'm creating interactive elements from nothing but the basic idea of them.

    Not trying to toot my own horn (fuck it "toot") but, the code is pretty sick.

    edit:

    oh yeah it's not 20000 lines. I added final line numbers for my entire code and it was only 8600 and some change. So, I was way off.
    Last edited by MadGypsy; 08-22-2014, 01:43 PM.
    http://www.nextgenquake.com

    Comment


    • #62
      @Mad
      Ah i think I understand. I'll play around with it. Thanks for the explanation. It is very clean and simple code to do something I would consider complex in terms of not needing additional code to accomplish the same thing. Bravo!

      Comment


      • #63
        let me show y'all the difference between JSON (javascript object notation) and VON (versatile object notation [my invention])

        To port the framework of the Object from my prior post to JSON would look like this
        Code:
        config:
        {
        	display:
        	[
        		{
        			child:
        			[
        				{
        					//graphicsObject
        				},
        				{
        					//textObject 
        				},
        				{
        					//graphicsObject
        				}
        			]
        		}
        	]
        }
        Notice that you are forced to use array literals and if you syntax it out the way I did there is an awful lot of nesting. In VON you don't have to do this. You can refer to array indexes directly.

        Code:
        config:
        {
        	display[0]:
        	{
        		child[0]:
        		{
        			//graphicsObject
        		},
        		child[1]:
        		{
        			//textObject 
        		},
        		child[2]:
        		{
        			//graphicsObject
        		}
        	}
        }
        That will produce identical results to the JSON way. There are some more differences though. Since all array indexes are Objects before they are whatever you tell them to be. The syntax below is totally legitimate in VON

        Code:
        someArray[0]:property:"value"
        this would treat someArray[0] like an Object from jump. Making the above syntax identical to

        Code:
        someArray[0]:
        {
        	property:"value"
        }
        Another way which VON will differ from JSON will be the

        someVector<int>:<100,20,40,32,56,78>

        possibility that will be added next. Followed by

        someMatrix:[a,b,c,d,e,f,g,h,i]

        And that's the gist on how I didn't just make a JSON parser.

        @Mad - that's just a word. Call me Gypsy, Michael or MG.
        Last edited by MadGypsy; 08-22-2014, 02:29 PM.
        http://www.nextgenquake.com

        Comment


        • #64
          Check it out. Last night I wrote out an Object that has all of the possible properties defined. Everything not marked as "coming soon" is a property that my class already possesses, the rest are possibilities that I need to add, and mostly adding them will be a nothing. Actually I can probably just copy my gradient fill case: and add the word "line" before all the properties. Most comments below include alternate values that can be used for that property.

          Code:
          GraphicsObject:
          {
          	classPath:"app.components.core.GraphicsObject",
          	properties:
          	{	x:0,
          		y:0,
          		width:100,
          		height:100,
          		fillType:"gradient", 		//solid [coming soon: bitmap]
          		shapeType:"roundRect",		//rect, circle, ellipse
          		type:"linear",				//radial
          		ellipseHeight:20,				//-this is corner radius for roundRect
          		ellipseWidth:NaN,				//-so is this in another direction
          		spreadMethod:"pad",			//reflect, repeat
          		interpolationMethod:"rgb",	//linearRGB
          		focalPointRatio:0,				//-type:"radial" only / -1 to 1 with 0 at center
          		colors:(0xFF0000,0xFFFFFF,0x0000FF),
          		alphas:(.5,.7,1),
          		ratios:(0x00,0x7A,0xFF),
          		matrix:
          		{
          			rotation:0,
          			tx:0,
          			ty:0
          		},
          		lineAlpha:1,
          		lineThickness:1,
          		lineColor:0x777777,
          		linePixelHinting:false,
          		lineScaleMode:"normal", 		//none, horizontal, vertical
          		lineCaps:null,					//none, round, square
          		lineJoints:null,				//miter, round, bevel
          		lineMiterLimit:3
          		
          		/* 
          			coming soon 
          		*/
          		path:
          		{
          			commands<int>:<1,3,2,2,2>,	//noOp:0 / moveTo:1 / lineTo:2 / curveTo:3 / wideLineTo:4 / wideMoveTo:5
          			data<Number>:<0,0,50,50,0,100,100,100,100,0,0,0>,	//x,y,ctX,ctY,x,y,x,y,x,y,x,y
          			winding:"evenOdd"			//nonZero
          		},
          		bitmap:
          		{
          			data:0,	//there are actually quite a few ways to get data here. image path, libSWF pointer, and any of that in a zip
          			repeat:true,
          			smooth:true
          		},
          		lineBitmap:
          		{
          			data:0,
          			repeat:true,
          			smooth:true
          		},
          		lineType:"gradient",			//solid, bitmap
          		lineColors:(/*Array*/0),
          		lineAlphas:(/*Array*/0),
          		lineRatios:(/*Array*/0),
          		lineMatrix:
          		{
          			rotation:0,
          			tx:0,
          			ty:0
          		},
          		lineSpreadMethod:"pad",			//reflect, repeat
          		lineInterpolationMethod:"rgb",	//linearRGB
          		lineFocalPointRatio:0,				//-type:"radial" only / -1 to 1 with 0 at center
          		
          	}
          }
          I'm going to write out the TextObject properties tonight. There are ALOT. YOu can pretty much set every conceivable property even down to htmlText and applying external stylesheets to the text. Not that you need those 2 options cause more than the supported features of those properties are natively supported as direct field or format properties.
          http://www.nextgenquake.com

          Comment


          • #65
            I'm over 100% back to where I was before the start over but I finally found my Design Patterns for AS3 book and I realized some of my patterns are wrong... start over again? This would hardly be a start over. More like a reorganizing/rerouting of code but, it could prove to be time consuming.

            I realized something else though. My shell is coupled to the display engine and I'm not really sure how to uncouple it. I have some ideas but they mostly rely on getting the design patterns right so I can refer to everything by interface and subclass a creator method to ?obfuscate? the classes.

            I think I need one last do-over. If I follow the patterns to the T, everything I want to do will work better. Luckily, this is mostly creating the proper patterns with blank classes and then dumping the body of the classes I already wrote in the proper spot. In other words I don't have to rewrite any code, I just need to "reposition" it.

            yep, mind is made up. I'm going to fix my patterns. Hopefully I can do it in one day. There is actually a lot of code to do this to and I have this thought brewing in the back of my mind, I don't grasp it yet but I can feel the gist entails many small patterns within one large one. I can almost see how I can "burn both ends of the candle" with a factory pattern to go from set A to retrieve D while completely internalizing B and C. hmmmmm...and you guys (some) think code is hard... pick up a book on design patterns and scripting will seem like a nothing in comparison.
            http://www.nextgenquake.com

            Comment


            • #66
              DOH! But I love failing/messing up. The end result is always so much better when you have to do it multiple times! Or as Edison put it...

              "How did it feel to fail 1,000 times?" Edison replied, "I didn�t fail 1,000 times. The light bulb was an invention with 1,000 steps."

              Comment


              • #67
                there is no do over to do. My patterns are correct and I'm already doing the idea I was forming in the back of my head, as well....crazy. I got fooled because my patterns include a branch. That branch is actually another pattern but I was considering it all one. If anything, I just realized (during my redo) that I've mastered the factory pattern...awesome, I still have to decouple engine/app though and that isnt awesome. Or maybe it's no big deal... I'm stumped.
                http://www.nextgenquake.com

                Comment


                • #68
                  Few Things:

                  I should have the engine uncoupled from any and all apps by tonight. It took me a while cause I had to isolate exactly where the coupling was occurring and then it took me a WHILE to figure out how to restructure the code to remove the coupling. I'm pretty sure I figured all that out but I need to square up a few things before I can test.

                  for the people that enjoy the technical end of this thread, below is basically the "Cliffs Comments" explanation of my entire file loading package. In the cases below where I post actual code, you are to understand that the code is a generification of every class in that category except where otherwise specified. Also, where I wrote SubCreator - that should maybe be SubProduct, that's trivial but, for clarity I'll throw that out there. Also note some of my tabs got f'd up when pasting. NextTab (how editors work) really isn't the same thing as Tab (\t).

                  The below isn't meant to be a script. It's just a package explanation with some universal code examples
                  Code:
                  Factory Pattern
                  
                  IParser.as - Product Interface
                  	//blueprint
                  	parse():object;
                  
                  Products:
                  	PLSObject.as - SubCreator: private class ParseObject
                  	VONObject.as - SubCreator: private class ParseObject
                  	ZipObject.as - SubCreator: public class ZipParser	//uncoupled to be used in recursion
                  	
                  	//generic structure
                  	package
                  	{	
                  		public class Product implements IParser
                  		{	private var source:String;
                  			public function Product(src:String):void 
                  			{	source = src;
                  			}
                  			public function parse():Object 
                  			{	return SubCreator.parse(source);
                  			}
                  		}
                  		
                  		//private class
                  		class SubCreator
                  		{
                  			public static function parse(source:String):Object
                  			{	/*code*/
                  			}
                  			...maybe more functions, depends on what you're parsing...
                  			...anything goes here, without destroying my interface...
                  		}
                  	}
                  	
                  	Other Products (built into flash):
                  	Object, Loader, Sound, String, XML, [ByteArray: this is a hidden product cause, this is the default for how file data arrives]
                  	
                  	
                  AIFile.as - Abstract Creator
                  	Abstract Methods:
                  		load(url:String):void
                  		loadBytes(typeset:String, content:ByteArray):*
                  		get data():*
                  	Concrete Methods:
                  		addListeners(target:*):void
                  		dropListeners(target:*):void
                  		handler(event:*):void
                  
                  Concrete Creators (subclasses):
                  	ByteType.as		- returns Object
                  	LoaderType.as	- returns Loader
                  	PLSType.as		- returns PLSObject (Object)
                  	SoundType.as	- returns Sound
                  	TextType.as		- returns String
                  	VONType.as		- returns VONOBject (Object)
                  	XMLType.as		- returns XML
                  	ZipType.as		- returns ZipObject (Object)
                  	FileLoader.as	- returns any Concrete Creator
                  	
                  	//generic structure
                  	private var request:URLRequest;
                  	private var loader:URLLoader;
                  	private var parser:IParser;
                  	private var file:AIFile;	//FileLoader only
                  	
                  	public function ConcreteCreator(url:String = null)
                  	{	if (url != null) this.load(url);
                  	}
                  	override public function load(url:String):void
                  	{	
                  		request = new URLRequest(url);
                  		loader = new URLLoader();
                  		loader.load(request);
                  		addListeners(loader);
                  		
                  		//FileLoader uses a switch/case comprised of every Concrete Creator except itself
                  		switch(url.split(/\./g).pop().toLowerCase())
                  		{	
                  			case "zip": file = new ZipType(url); break;
                  			case "von": file = new VONType(url); break;
                  			case "vob": file = new ByteType(url); break;
                  			case "xml": file = new XMLType(url); break;
                  			case "swf": file = new LoaderType(url); break;
                  			case "txt": file = new TextType(url); break;
                  			case "mp3": 	...etc...
                  		}
                  	}
                  	override public function get data():*
                  	{	parser = new Product(loader.data); 	
                  		return parser.parse() as DesiredType;
                  		
                  		//FileLoader is just
                  		return file.data;
                  	}
                  	
                  	//FileLoader includes loadBytes Method
                  	override public function loadBytes(typeset:String, content:ByteArray):*
                  	{	var t_string:String = content.readUTFBytes(content.bytesAvailable);
                  		var ldr:Loader;
                  		
                  		switch (typeset)
                  		{
                  			case "XMLType": 
                  				return XML(content);
                  			case "ByteType": 
                  				var bytes:ByteArray = Base64.decodeToByteArray(t_string);
                  				bytes.position = 0;
                  				
                  				var obj:Object = bytes.readObject();
                  				return obj; //trying to directly return bytes.readObject() results in a range error
                  			case "ZipType":
                  				
                  				...etc...
                  		}
                  		
                  		return null;
                  	}
                  	
                  How to implement package:
                  
                  package
                  {
                  	import files.FileLoader;
                  	import flash.events.Event;
                  	import flash.events.IOErrorEvent;
                  
                  	public class Main extends Sprite
                  	{
                  		private var fileLoader:FileLoader;
                  		
                  		public function Main():void
                  		{
                  			var url:String = "some/path/file.ext"
                  			
                  			fileLoader = new FileLoader();
                  			with(fileLoader)
                  			{
                  				addEventListener(Event.COMPLETE, handler);
                  				addEventListener(IOErrorEvent.IO_ERROR, handler);
                  				load(url);
                  			}
                  		}
                  		
                  		private function handler(event:*):void
                  		{	with(event.target)
                  			{	removeEventListener(Event.COMPLETE, handler);
                  				removeEventListener(IOErrorEvent.IO_ERROR, handler);
                  			}
                  			switch(event.type)
                  			{
                  				case Event.COMPLETE:
                  					//FILE LOADED: event.target.data 
                  					break;
                  				case IOErrorEvent.IO_ERROR:
                  					//file didn't load
                  					break;
                  			}
                  		}
                  	}
                  }
                  Last edited by MadGypsy; 08-28-2014, 11:04 AM.
                  http://www.nextgenquake.com

                  Comment


                  • #69
                    Originally posted by MadGypsy View Post
                    I had to isolate exactly where the coupling was occurring and then it took me a WHILE to figure out how to restructure the code to remove the coupling.
                    What? I don't mean to be rude or disrespectful, but what are you talking about? Coupling? This sounds like a complicated topic!
                    "Through my contact lenses, I have seen them all, I've seen wicked clowns and broken dreams / Crazy men in jumpsuits trying to be extreme and messing around with your computer screen" - Creative Rhyme (03/23/2012)

                    Comment


                    • #70
                      when 2 or more things are joined and each has a dependency on at least one of the others. Coupling is also bad OOP. I overlooked this initially because, I am building 3 projects all at once (in the same project folder). Once I separated the projects, it became clear where they were going to break. It wasn't simple to figure out how to fix it though.
                      Last edited by MadGypsy; 08-28-2014, 06:39 PM.
                      http://www.nextgenquake.com

                      Comment


                      • #71
                        What's going on with this project?

                        It may seem like I'm dragging ass or maybe even like I've stopped. Neither of those possibilities are true.

                        few facts:

                        1) This "one" project is actually 3
                        2) one of the 3 is complete (fake system shell)
                        3) when I started this project I knew it was going to force me to connect unconnected dots in my display engine. That was actually the point... build a concrete app based on an engine that doesn't exist, forcing me to figure out how the engine will work.

                        That's about where I am now. I've ripped this engine apart and built it back up NUMEROUS times in just the last week+. This is mostly due to me having an ever increasing understanding of design patterns. This display engine will be the backbone of my android development and I want it to be as pro coded as I can provide. That being said, It's more important to me to get this foundation laid properly, than it is to puff out a build menu app. The build menu app WILL be the first app I produce when I feel like my display engine has the structure that I am satisfied with and intend to keep.

                        currently I have a factory pattern being instantiated by a composite pattern and functionally mutated by a decorator pattern. I'm still testing the extensibility and manageability of my pattern combination.
                        http://www.nextgenquake.com

                        Comment


                        • #72
                          MadGypsy, I would like to ask you some questions that are somewhat off-topic but also somewhat emotional... 1. Do you appreciate the true beauty of computer logic? Go ahead and laugh but I think that there is a close connection between logic, computer programming, mathematics, and philosophy. (They are all brothers, because they encourage humans to argue and to analyze things.) But I'm asking you for your opinion... 2. Have you ever attended a party where everyone else knew nothing about computers? Did you ever bring up computer terminology? Did you see people scratching their heads and asking themselves: "WTF is this person talking about!?!" No really, I don't mean to sound like a nerd, but the computer world is beautiful. The computer world is an intellectual dimension. MadGypsy, I don't know how often you read this thread, but if I have a random question about technology, I think that I should ask you. You're so stoned that you must know what you're talking about! Just kidding! We have crossed a really big chasm here...
                          "Through my contact lenses, I have seen them all, I've seen wicked clowns and broken dreams / Crazy men in jumpsuits trying to be extreme and messing around with your computer screen" - Creative Rhyme (03/23/2012)

                          Comment


                          • #73
                            Project dead?
                            WARNING
                            May be too intense for some viewers.
                            Stress Relief Device
                            ....BANG HEAD HERE....
                            ---------------------------
                            .
                            .
                            .
                            .
                            .--------------------------

                            Comment


                            • #74
                              Well, it doesn't have to be. Actually, I was cleaning up some drives on my PC last week and came across all the project files for this. It's a shame none of you program in AS3 cause I would share the source and let someone roll with it.

                              @RL - I'm sorry, I missed your question some kind of way.

                              1) Of course, that's why I program in like 9 languages (maybe more)
                              2) lol, not that I remember. Party = Ladies, Ladies = I like them and do not want to bore the shit out of them.
                              @stoned - almost never. I'm not saying that I was never a major pothead. I'm saying that I'm not one now and generally only smoke when I find myself in social situations (not just hanging out) where some bud is floating around.
                              Last edited by MadGypsy; 03-11-2015, 10:53 AM.
                              http://www.nextgenquake.com

                              Comment


                              • #75
                                It's a shame this guy was banned. There is nobody here that can hold a candle to him in writing informative posts and creating projects that stand alone from practically this entire community. I was one of the guests he hated so much, for years. Looking back, I regret that I didn't participate. This site is at a loss for "meat and potatoes" posts without him.

                                it doesn't negate it. Consider this:

                                You have 3 objects in a parent object and only one of those is required to have mouse events attached to it. The parent object holds no named reference of these objects so there has to be a system to apply the events in a standalone manner.

                                I initiate a mouseDown event listener on the appropriate child. When you mouse down, whatever had the event attached to it then has the Up/Over/Out events attached to it. Understand that this is component specific. The Caption component is the one to make these decisions. There are definitely other ways to handle objects which are mouse interactive but, for this case this is a very clever way.

                                Without ever telling the parent - do X to specific.Object or ever even making a specific.Object I get the same functionality as if I built a static element with named children.

                                When I explain my button code and how it inherits the same interface but utilizes it differently you'll really get the idea of how my Objects are all concepts. I'm creating interactive elements from nothing but the basic idea of them.

                                Comment

                                Working...
                                X