I've created some shapes and connected them with bones, that bones have some names, IKbone1, IKbone2...
so the questions is: How can I access to those bones by name in AS3, because I've tried that in I get an error that there are no object name...
any advice?
A manual
IK structure seems to be rather complex in Flash, you first need to reach the correct armature, then you can get bone by name via IKArmature.getBoneByName(). The main data set in those IK bones is stored in points (joints) instead of actual bones.
Related
I'm learning Om.
The Om documentation
makes frequent use of the phrase "the backing Om component". I'm fairly sure that should be "the backing React component", a phrase that is used in the Om Basic Tutorial.
Can someone verify that?
Edit: Actually I'm not sure at all. But I guess either the documentation or the tutorial is wrong.
I spoke to an Om expert. The backing components are React components.
Would be lovely to have David here to answer but I'd rather go with Om component. Om is not only wrapper around React, it goes a little further. Therefore working with Om you should rely on Om documentation. In Om docs you can find annotations: "identical to React", "conceptually analogous to React", etc... but not every function is like that.
Going to the end: when working with Om using name "Om component" is, surely, more appropriate than "React comp", cause, even vastly similar, those are two different libs.
I’m trying to create simple model in 3dsmax. My model is just a square with two bones.
I wonder how to export it (whatever format), import to Away3d and control the bones.
I know that it’s must load a skeleton and get the bones by a name.
I was trying to use Prefab, but it didn’t work.
Any ideas or examples will very usefull.
Thanks!
I'm trying to make something similar to this:
http://www.personalwine.com/catalog/label_designer_app.php?templateId=5046&action=4C92&userId=0
in Flash IDE with AS3.
My problem is how to save all objects on a stage, save it as a "template" and reuse it again - not as images, but as objects that can be editable again.
Could anyone point me to the right direction on how to solve this problem.
Thanks in advance!
Maybe a xml save/load function could help. Once one created something on save, all attributes of each object are written to a xml file. If you want to recreate, then you parse the info and build the screen.
Where?
You have two choices for saving data, you can either save it on the user's computer (client-side) or on your own server (server-side).
On the server
If you're going to use anything that is server-side related well, obviously you're going to need a server (and a database). Using php with mysql is both free and very fast for this sort of usage (small). You might also want to look into node.js since it will probably come very intuitively to an actionscript user since node is javascript and the syntax and structure of node.js files and actionscript files are very similar.
On the user's pc
If you just want to store the data on the user's computer, you can use a SharedObject, it will save all the data you need (variables and such) on the user's computer.
Here is a short nice tutorial on how to do so:
http://kirill-poletaev.blogspot.com/2010/07/how-to-save-local-data-with.html
Here is a much bigger and more detailed tutorial:
http://active.tutsplus.com/tutorials/actionscript/movieclip-reconstruction-with-the-sharedobject-class/
Basically you can do this for all the variables you want to save (movieclip locations, etc) and then load them. It is very straightforward, you can even store a whole movieclip object.
My demo application I'm working on has a very long startup routine. The application I'm trying to replace with the new ideas log a lot to the console during that (imagine: "now loading data... reticulating splines... login to third party service...").
After spending the whole day learning DI basically from scratch, I create the whole (!) object graph now with a single call to the container. Thank you, everybody here, btw, for providing so many ideas and amazing answers. This community rocks.
But now, what I want to do is to make initialization deterministic again, so I can log in my workflow (I'm using Workflow Foundation 4.0, because I like the declarative style and the fact that I can show people in graphics what happens) when I load data, reticulate splines and all that.
Do you think it would be an acceptable practice to have a "StartupManager" - class (the only singleton in my architecture now, I killed every other "instance getter"!) that will call secondary initialization methods on the objects it got injected (I used buildUp() and property based DI here)?
Reason is that I want to explicitly call the long initialization methods in my workflow activities. Looks amazing in the editor, my boss will be very happy when I present that (he didn't ask for it, it was my idea to spend the weekend doing something, also I think it is a lot of fun).
i assume you're creating your own DI framework for fun and to learn, right? otherwise just use existing one.
no :) you shouldn't have anything static. your algorithm may look like that:
create instance of your DI builder
feed that instance with dependencies definition (from file or programatically)
call your buildUp on that configured builder. this method should return an instance of context
on the context you call give_me_object_x and you should get an object x filled with all dependencies
or just look how spring is built - it's a very good example of well written DI framework
During coding I frequently encounter this situation:
I have several objects (ConcreteType1, ConcreteType2, ...) with the same base type AbstractType, which has abstract methods save and load . Each object can (and has to) save some specific kind of data, by overriding the save method.
I have a list of AbstractType objects which contains various ConcreteTypeX objects.
I walk the list and the save method for each object.
At this point I think it's a good OO design. (Or am I wrong?) The problems start when I want to reload the data:
Each object can load its own data, but I have to know the concrete type in advance, so I can instantiate the right ConcreteTypeX and call the load method. So the loading method has to know a great deal about the concrete types. I usually "solved" this problem by writing some kind of marker before calling save, which is used by the loader to determine the right ConcreteTypeX.
I always had/have a bad feeling about this. It feels like some kind of anti-pattern...
Are there better ways?
EDIT:
I'm sorry for the confusion, I re-wrote some of the text.
I'm aware of serialization and perhaps there is some next-to-perfect solution in Java/.NET/yourFavoriteLanguage, but I'm searching for a general solution, which might be better and more "OOP-ish" compared to my concept.
Is this either .NET or Java? If so, why aren't you using serialisation?
If you can't simply use serialization, then I would still definitely pull the object loading logic out of the base class. Your instinct is correct, leading you to correctly identify a code smell. The base class shouldn't need to change when you change or add derived classes.
The problem is, something has to load the data and instantiate those objects. This sounds like a job for the Abstract Factory pattern.
There are better ways, but let's take a step back and look at it conceptually. What are all objects doing? Loading and Saving. When you get the object from memory, you really don't to have to care whether it gets its information from a file, a database, or the windows registry. You just want the object loaded. That's important to remember because later on, your maintanence programmer will look at the LoadFromFile() method and wonder, "Why is it called that since it really doesn't load anything from a file?"
Secondly, you're running into the issue that we all run into, and it's based in dividing work. You want a level that handles getting data from a physical source; you want a level that manipulates this data, and you want a level that displays this data. This is the crux of N-Tier Development. I've linked to an article that discusses your problem in great detail, and details how to create a Data Access Layer to resolve your issue. There are also numerous code projects here and here.
If it's Java you seek, simply substitute 'java' for .NET and search for 'Java N-Tier development'. However, besides syntactical differences, the design structure is the same.