Can't Create Object
hello,
i've a problem with WDDX. Although the beneath code works in another project without any problems, in my new project i cant create an instance of WDDX.
if i debug the function, variable foo is "undefined" after "foo = new WDDX()" and i cant find any reason for that.
Code: on (release) { #include "wddx_mx.as"
XML.prototype.ignoreWhite = true; myXML = new XML();
myXML.load ("http://www.myurl.at/script.php?name=" + name + "&strasze=" + strasse + "&ort=" + ort + "&email=" + email");
myXML.onLoad = function () { foo = new WDDX(); wddxObj = foo.deserialize( this ); for (i in wddxObj) { arr = wddxObj[i]; }
delete (myXML); } } i'd be thankful for any hint i get
stefan
SitePoint > Design Your Site > Flash and Actionscript
Posted on: Jun 10, 2003, 03:00
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Create Object Within Object, Dynamically?
Howdy,
I'm creating a firework show. The main timeline creates rocket objects nicely. When it's time for the rocket to explode, creating projectiles in the Rocket object in the same way as the main timeline, it does NOT work dynamically. I can only seem to get it to work in a static way. Here are some examples:
main timeline (works great!):
Code:
this["rocket" + rocketInt] = new Rocket();
this["rocket" + rocketInt].name = "rocket" + rocketInt;
addChild(this["rocket" + rocketInt]);
rocketInt++;
in Rocket (does not work):
Error: ReferenceError: Error #1056: Cannot create property projectile0 on xx.xx.fireworks.Rocket. This error occurs even if all but the first line is commented out.
Code:
this["projectile" + _projectileInt] = new Projectile();
this["projectile" + _projectileInt].name = "projectile" + _projectileInt;
addChild(this["projectile" + _projectileInt]);
_projectileInt++;
in Rocket statically (works, but no fun):
Code:
var projectile0:Sprite = new Projectile();
projectile0.name = "projectile0";
addChild(projectile0);
The last example does exactly what I need it to... but The number of projectiles could be anywhere from 1 to 50. I'd hate to do all that in a non-dynamic way.
Is there any hope?
Thank you much for the assist.
Create New Object
I am a newbie flash user. just for the record...
I would like to know how to create a new object, fx a button relative to the x and y coordinate of another button. I know how to work with th ecoordinates but i dont know what to write to create a bran new object???
How Do I Create A New Object From..
Hi,
I'm trying to do something like this..
var myObject:Object = new myObjectIDs[myIndex];
to create objects from a list of object names, but it's not working, how would I do that?
Create An XML Object With AS3
I want to create a basic XML object in AS3, but don't know how to do this.
I first tried creating a string that represented my XML elements and their values, but then I don't know how to convert this string into an XML object.
Secondly, I believe there are other ways of creating XML objects in AS without doing anything with strings.
Can somebody please recommend to me a way to do this?
An XML example to create with AS3 is:
Attach Code
<people>
<person>
<name>Joe</name>
<city>Minneapolis</city>
</person>
<person>
<name>Sally</name>
<city>Las Vegas</city>
</person>
</people>
Create Object In Object
Hi!
I have some problems. I want create an object with set of properties, so I can later change it. And this object will be duplicated. Quit simple. But This object must have another one inside it, that can be olso duplicated and has some properties. Now my code:
This is first part
------------------------------------
function Cathegory(name, i) {
duplicateMovieClip("_root.Cathegory", name, i);
this.name = name;
}
Cathegory.prototype.x = function(xcoord) {
setProperty(this.name, _x, xcoord);
};
Cathegory.prototype.y = function(ycoord) {
setProperty(this.name, _y, ycoord);
};
Cathegory.prototype.title = function(title) {
set(this.name+".Title", title);
};
var Cathegory1 = new Cathegory("HA!", 50);
Cathegory1.x(200);
Cathegory1.y(200);
Cathegory1.title("ok!");
------------------------------------
But how to make this inside object I don't know.
It's must be something like this may be:
------------------------------------
Cathegory.prototype.Cell = function() {
duplicateMovieClip(this.cell, name, i);
this.cell.name = name;
};
var Cathegory1.Cell1 = new Cathegory.Cell("Oho!!", 51);
Cathegory1.Cell1.x(200);
------------------------------------
Is hear somebody who understand what I say?
Create Object Dinamically
Hi !
Should anyone help me ?
I would like to create objects from variable classes.
ie:
x = new (sClassname) (parameters)
where sClassname is a string variable containing the class name
Construct a string "new classone (a,b,c)" and eval() it, does not work.
Thanks for any idea.
Create/Destroy Object Help
I have a challenge that is driving me nuts. There should be a simple solution to this but I think the forest and the tress analogy is what I've got going on. I have a very simple setup - a Flash file is loading a text file with a number of variables and values. The Flash file creates a series of buttons and labels based on the info that is coming in from the text file. Once the items are on the screen, I want the user to be able to choose a button and the program SHOULD clear all the created objects off the stage so new objects can show up.
I have attached the code for the Flash file the first set is on the first frame and the second on the second frame. I know that everything works up to the destroyObject call. Objects show up on the stage, they are given the correct text and instance names and they even send info (like their instance name) to the listener. The stupid objects just won't go away!
Any suggestions? Thanks for the help!
//frame 1 AS
loadVariables("installer.txt", _root);
_global.style.setStyle("fontSize", 18);
//"loop" while loading variables from text file
function checkParamsLoaded() {
if (_root.completeVar="yes") {
clearInterval(param_interval);
gotoAndStop(2);
} else {
trace("loading");
}
}
//put "loop" in motion
var param_interval:Number = setInterval(checkParamsLoaded, 100);
//
stop();
//frame 2 AS
var yLoc:Number = 485;
for (var i:Number = 1; i<9; i++) {
if (this["lang"+String(i)] == undefined) {
i = 9;
} else {
yLoc = yLoc-40;
_root.createClassObject(mx.controls.Button, "lang"+i+"Inst", this.getNextHighestDepth(), {_x:500, _y:yLoc, _width:130, _height:30, label:this["lang"+String(i)]});
_root.createClassObject(mx.controls.Label, "inst"+i+"Inst", this.getNextHighestDepth(), {_x:350, _y:yLoc, autoSize:"right", text:this["inst"+String(i)]});
}
}
stop();
//functions and listeners for all buttons to be clicked
var listener:Object = new Object();
listener.click = function(button) {
//clear the stage
for (var i:Number = 1; i<9; i++) {
if (this["lang"+String(i)] == undefined) {
i = 9;
} else {
destroyObject("lang"+i+"Inst");
destroyObject("inst"+i+"Inst");
}
}
};
for (var i:Number = 1; i<9; i++) {
this["lang"+i+"Inst"].addEventListener("click", listener);
}
Create On The Fly An Object Each Loop
I'm trying here in the function below to create on the fly an object each loop, the problem is something I cant see.
first i create a temp variable to store the string name
Code:
var tempCountry:String = new String;
then i set that to my changing value (a country name) each loop
Code:
tempCountry=this.childNodes[0].childNodes[i].childNodes[0].lastChild.nodeValue;
then try to create the object
Code:
var tempCountry:Object = new Object();
I think there is a one line to do this maybe, and then I need to create the properties of each object created.
Code:
private function tree(){
var count:Number = this.childNodes[0].childNodes.length;
for (var i=0;i<count;i++){
var tempCountry:String = new String;tempCountry=this.childNodes[0].childNodes[i].childNodes[0].lastChild.nodeValue;
var tempCountry:Object = new Object();
}
}
thanks for the insight
How To Create An Object Hierarchy Using As3?
I have an actionscript class as follows:
package Test{
public class Role{
private var _roleCode:String;
private var _roleName:String;
private var _inheritedFromRole:Role;
//put all your getters and setters for the above
//mentioned attributes.
}
}
When I try to create an instance of such a class, Flash gets into an indefinite loop and finally exits with an out of memory exception.
Is there a way to fix this issue?
Thanks in advance.
Create An Object With Name From A String
I'm having some difficulties to describe my problem, but I hope someone still understands it
I have a method called switchPage which receives 1 String parameter (the classname of the Object that should be created). The problem is that I don't know how to make that String into a new instance of an object with the parameter name.
Here's an idea of basically what I want to accomplish.
ActionScript Code:
private function switchPage(pageID:String):void
{
var contentPage:pageID = new pageID();
}
How To Create Object With String?
Hi all,
Is there anyway to create an object with a string?
For example :
var myClassString:String = "myClass"; // myClass is my real class
then create an object with something like :
var myObject object = new myClassString(); // I need to create the object from the string ....
Anyone please? Many Thanks in advance.
Best Regards
Create Object Dynamically
for buttons, i create it dynamically by
ActionScript Code:
import mx.controls.Button; createClassObject(Button, "self0", 5, {_height:30, _width:50, _x:700, _y:10}); self0._visible = true; self0.enabled = true; self0.label = "Self"; self0._alpha = 100;
so how do i insert an image dynamically? do i use the same class function? if its the same, for the IMPORT part, how do i write it?
Using A Conditional To Create A New Object
This I don't understand at all...
I have a bucnh of code already written that accesses a movieclip I've called "sb". The requirements for the project have changed, and I need to have a slightly different version of the clip load if we're in a different place in the Flash. All the other code I've written for "sb" will stay the same, I just need the following condition to determine which version of the clip will be loaded:
Code:
if (level == 0) {
var sb:navSB02 = new navSB02();
} else {
var sb:navSB = new navSB();
}
I get the follwoing error:
1151: A conflict exists with definition sb in namespace internal.
I understand what the error means. I can change one of the variable names to "sb2" or whatever, but then I have to put conditionals throughout the rest of my code to determine which clip it should reference.
Is there any way to work around this? This seems like this should be a simple thing to do.
How To Create Object With String?
Hi all,
Is there anyway to create an object with a string?
For example :
var myClassString:String = "myClass"; // myClass is my real class
then create an object with something like :
var myObject object = new myClassString(); // I need to create the object from the string ....
Anyone please? Many Thanks in advance.
Best Regards
Create 3d Object From Image?
Hi..
Quite new to Flash here.. So here's hopefully an easy beginner question.. I have an object, a baseball.. I would like to make a flash movie of the object rotating, and then do some zooming..
What I think from reading quite a bit, is that I need to somehow convert the image that I have of the baseball, into a 3d object.. But I'm not sure where to go from there.. Can someone point me in the right direction?
Thanks
David
Create Duplicate Of Object
I have an object that I have created with "foo = new Object()". I would like to create a duplicate of this object, but it seems every way I try, the duplicate is actually just a reference to the same original object.
For example:
[code]foo = new Object();
foo.member = 3;
bar = foo;
bar.member = 5;
trace(bar.member); // It outputs 5, of course
trace(foo.member); // It outputs 5 also ?!?!?
Of course that's a trivial case. But I need to duplicate the object so that the new object is completely separate from the original. Is it even possible?
All help is appreciated.
How To Create Object With String?
Hi all,
Is there anyway to create an object with a string?
For example :
var myClassString:String = "myClass"; // myClass is my real class
then create an object with something like :
var myObject object = new myClassString(); // I need to create the object from the string ....
Anyone please? Many Thanks in advance.
Best Regards
Create New Object With Dynamic Path Name
I am trying to parse a xml doct which is an unknown number of levels deep, to create an Object.
As I recursively parse each element, if it hasChildNodes, I add the element to an array, named 'elementStack'. As I create each sub-object, I need to put it in the correct place, something like:
_root.course[elementStack.join(".")] = new Section(id, title, rolloverHintText, durationMinutes);
Sadly, however, this does not work. Neither does
elementStack.join("][")
The result I'm after is either:
_root.course["m1"]["m1s2"] = new Section...
or
_root.course.m1.m1s2 = new Section...
Urm, do I need 'eval' - tried that too, to no avail.
Please help... many thanks in advance
Nik
How To Create A Global Variable From Within An Object?
I have an object on my stage, and within that object I have embedded some ActionScript. It's simple, something like this:
number = 5;
It works fine within that scene, but when I go to any other scene, I can no longer reference that variable. It comes up as "undefined."
How do I create a variable within that object that I can access from anywhere within my movie?
Create/insert NEW Xml Elements Into Object
so everyone at hoem can try this:
heres a smaller sample of the XML file I am using: (so all pathing will be the same for everyone)
PHP Code:
<products>
<product>
<image>image1.jpg</image>
<name>PiraTe 1</name>
<price>1.99</price>
<size>
<choice>X-SMALL</choice>
<choice>SMALL</choice>
<choice>MEDIUM</choice>
<choice>LARGE</choice>
<choice>X-LARGE</choice>
<choice>XX-LARGE</choice>
</size>
<color>
<choice>BLACK</choice>
<choice>GREY</choice>
<choice>WHITE</choice>
</color>
<description>etc..etc..etc.</description>
<link>javascript:NewWindow=window.open('image1.jpg','Product_Details','width=85,height=100,left=100,top=100,screenX=100,screenY=100');NewWindow.focus();void(0);</link>
<quantity>
<choice>1</choice>
<choice>2</choice>
<choice>3</choice>
<choice>4</choice>
<choice>5</choice>
</quantity>
</product>
<product>
<image>image1.jpg</image>
<name>PiraTe 1</name>
<price>1.99</price>
<size>
<choice>X-SMALL</choice>
<choice>SMALL</choice>
<choice>MEDIUM</choice>
<choice>LARGE</choice>
</size>
<color>
<choice>GREEN</choice>
<choice>BLACK</choice>
<choice>GREY</choice>
<choice>RED</choice>
</color>
<description>etc..etc..etc.</description>
<link>javascript:NewWindow=window.open('image1.jpg','Product_Details','width=85,height=100,left=100,top=100,screenX=100,screenY=100');NewWindow.focus();void(0);</link>
<quantity>
<choice>1</choice>
<choice>2</choice>
<choice>3</choice>
<choice>4</choice>
<choice>5</choice>
</quantity>
</product>
<product>
<image>image1.jpg</image>
<name>PiraTe 1</name>
<price>1.99</price>
<size>
<choice>X-SMALL</choice>
<choice>SMALL</choice>
<choice>MEDIUM</choice>
<choice>LARGE</choice>
</size>
<color>
<choice>GREEN</choice>
<choice>BLACK</choice>
<choice>GREY</choice>
<choice>RED</choice>
</color>
<description>etc..etc..etc.</description>
<link>javascript:NewWindow=window.open('image1.jpg','Product_Details','width=85,height=100,left=100,top=100,screenX=100,screenY=100');NewWindow.focus();void(0);</link>
<quantity>
<choice>1</choice>
<choice>2</choice>
</quantity>
</product>
<product>
<image>image1.jpg</image>
<name>PiraTe 1</name>
<price>1.99</price>
<size>
<choice>X-SMALL</choice>
<choice>SMALL</choice>
<choice>MEDIUM</choice>
<choice>LARGE</choice>
<choice>X-LARGE</choice>
<choice>XX-LARGE</choice>
</size>
<color>
<choice>GREEN</choice>
<choice>BLACK</choice>
<choice>GREY</choice>
<choice>RED</choice>
</color>
<description>etc..etc..etc.</description>
<link>javascript:NewWindow=window.open('image1.jpg','Product_Details','width=85,height=100,left=100,top=100,screenX=100,screenY=100');NewWindow.focus();void(0);</link>
<quantity>
<choice>1</choice>
<choice>2</choice>
<choice>3</choice>
<choice>4</choice>
<choice>5</choice>
</quantity>
</product>
<product>
<image>image2.jpg</image>
<name>X-Bones 2</name>
<price>9.99</price>
<size>
<choice>X-SMALL</choice>
<choice>SMALL</choice>
<choice>MEDIUM</choice>
<choice>LARGE</choice>
<choice>X-LARGE</choice>
<choice>XX-LARGE</choice>
</size>
<color>
<choice>GREEN</choice>
</color>
<description>etc..etc..etc.</description>
<link>javascript:NewWindow=window.open('image2.jpg','Product_Details','width=85,height=100,left=100,top=100,screenX=100,screenY=100');NewWindow.focus();void(0);</link>
<quantity>
<choice>1</choice>
<choice>2</choice>
<choice>3</choice>
<choice>4</choice>
<choice>5</choice>
</quantity>
</product>
</products>
All I am trying to do is append some new elements and child elements to the XML object above...
(basiclaly another product Node)
Code:
<products>
<image></image>
<name></name>
<price></price>
<size></size>
<color></color>
<description></description>
<link></link>
<quantity></quantity>
</product>
with NO textNODES (values) in them (for now)
I have been playing with variants of this code:
Code:
on (release) {
var xmlShortCut = _root.allPanels_mc.shirtPanel.productHolder_mc.objectClip;
var rootNode:XMLNode = myProducts_xml.firstChild;
productsNode = rootNode.childNodes;
//create NEW product Node
// create XML nodes using createElement()
var newProductNode:XMLNode = xmlShortCut.myProducts_xml.createElement("product");
var newImageNode:XMLNode = xmlShortCut.myProducts_xml.createElement("image");
var newNameNode:XMLNode = xmlShortCut.myProducts_xml.createElement("name");
var newPriceNode:XMLNode = xmlShortCut.myProducts_xml.createElement("price");
var newSizeNode:XMLNode = xmlShortCut.myProducts_xml.createElement("size");
var newColorNode:XMLNode = xmlShortCut.myProducts_xml.createElement("color");
var newDescriptionNode:XMLNode = xmlShortCut.myProducts_xml.createElement("description");
var newLilnkNode:XMLNode = xmlShortCut.myProducts_xml.createElement("link");
var newQuantityNode:XMLNode = xmlShortCut.myProducts_xml.createElement("quantity");
// place the new nodes into the XML tree
//xmlShortCut.myProducts_xml.productsNode.appendChild(newProductNode);
xmlShortCut.myProducts_xml.productsNode.insertBefore(newProductNode, xmlShortCut.productsNode[0]);
trace("BLANK NODE: "+xmlShortCut.productsNode[0]);
trace("Insert before this: "+xmlShortCut.productsNode[1]);
productsNode.appendChild(newImageNode);
newProductNode.appendChild(newNameNode);
newProductNode.appendChild(newPriceNode);
newProductNode.appendChild(newSizeNode);
newProductNode.appendChild(newColorNode);
newProductNode.appendChild(newDescriptionNode);
newProductNode.appendChild(newLinkNode);
newProductNode.appendChild(newQuantityNode);
trace("NEW XML TREE: "+xmlShortCut.productsNode);
}
IDEALLY: I would like to contruct this newProduct 'xml' object OUTSIDE of the current XML object (loaded at runtime an is the file/object posted above)..
and then append the WHOLE thing (new productNode) to the exsisting XML object when the SAVE button is clicked..instead of how I am doing it now......but this is just a starting point..
so summary, construct a xml object for a newProduct (void of values) and the populat it and "THEN" append it to my exsisting XML objct..
anyone?
thanks gang..
Dynamically Create A Loadvars Object
//would like to dynamically create a Loadvars object but I just dont know how
//to do it. Perhaps someone out there knows the solution
------------code---------------------------------------
var theArray:Array = new Array("_name","_address", "_city");
varMailSendRec = new LoadVars();
for(var i = 0; i< theArray.length; i++)
{
//here's my problem
// I would like to dynamically create variables to the Loadvars object
//so that the output becomes
varMailSendRec.theArray[i] = "first value";//and so on for each value in 'theArray'
}
btn.onRelease = function()
{
//then I want to send all variables connected to the Loadvars object
varMailSendRec.sendAndLoad("http://www.address.php", varMailRec,"POST");
}
Howto: Create Object Arrays?
Hey people,
I want to create an object array.
For example take the object "label1" then I want to make that I can use an array.
Like Label1(0) and Label1(1) to 9.
That I can use this:
Code:
While (i <= 9) {
Label1(i).text = "Sample Text"
i++}
With Label1(index) being a dynamic textbox...
How can I do this?
Cheers Jasper
Create A Variable On A Specific Object
I would to know the state of my checkbox
here is the code
Code:
on(release){
if(this._name[checkBoxState] == undefined || this._name[checkBoxState] == false){
this._name[checkBoxState] = true;
this.gotoAndStop(2);
}
else{
this._name[checkBoxState] = false;
this.gotoAndStop(1);
}
trace(this._name[checkBoxState]);
}
I would to merge the variable on the name of the button because I will have more than 1 checkbox on the screen. Is there a way of doinf it ?
How To Create Simple Object Array
i need to create an array of 80 square objects that have the vars of color, size and ID number in them and i can't do that at all.
Can someone please help me with that task
Thank you ahead
Using Pictures To Create A Rotating 3D Object
Ok so I'm a noob when it comes to Flash so this may be really simple but then again it could be extremely difficult I don't know. I need to create a Flash document that contains an object that can be rotated 360 degrees using a scroller using pictures of the object probably in jpeg format. If someone could tell me what level of difficulty and maybe point me in the right direction I would appreciate it very much! Thanks!
How To Create Multiple Different Instances Of An Object
If I want to reuse the same object to make several instances with different text inside (i'm not going to use actionscript, only the flash UI), which is the easiest way ?
Should I duplicate the object in the library ? And then, if I want to change something, I have to change every single instance ?
thanks
[fmx04]Can't Create Over And Up Actions For Same Object
I am creating an animated menu for my personal website, but it's turning into much more of a headache than I had originally bargained for! A lot of the tough stuff is working, but now I'm up against a wall.
I know this is long, so let me start with a summary: All I need is a MouseOver and a MouseUp event on the same object.
Because of the scrolling nature of the menu, I need to have MouseOver events on each menutab. Each menu item is hidden until a MouseOver event, then it scrolls out to reveal its title. If the user clicks on the now-revealed tab, it should become the current page. If the user does NOT click the now-revealed tab, it reverts to displaying the current page's tab instead.
This means that I need to have a MouseOver and a MouseUp (or Release) tag on my items. Since I probably confused you all as much as I just confused myself, here is the example.
http://www.stevemarshall.net/test/
The "Family" section should be displayed. As you can see, when the user runs the mouse over other tabs, they are revealed. When the mouse goes away, it reverts to the Family section because nothing else was selected.
The menu operates on frame 2 - frame 1 sets the initial variables as shown.
Code:
var sel = "family";
var games = "0";
var movies = "0";
var artwork = "0";
var yugi = "0";
var about = "0";
var links = "0";
Frame 2 operates my rollovers in a frame action as shown.
Code:
about_mc.btn_about.onRollOver = function() {
if (games == "0") { games_mc.gotoAndPlay("_over"); }
if (movies == "0") { movies_mc.gotoAndPlay("_over"); }
if (artwork == "0") { artwork_mc.gotoAndPlay("_over"); }
if (yugi == "0") { yugi_mc.gotoAndPlay("_over"); }
if (about == "0") { about_mc.gotoAndPlay("_over"); }
if (links == "1") { links_mc.gotoAndPlay("_out"); }
games = "1";
movies = "1";
artwork = "1";
yugi = "1";
about = "1";
links = "0";
gotoAndStop(2);
}
... this section of code is repeated for every tab, adjusting where "1" means the tab is on the left and "0" means the tab is on the right.
I also have another hidden button - it is a border placed over the top of the menu. When the user rolls over this hidden border (when the mouse leaves the menu area), it reverts back to displaying the current menu tab. This is my _level0; the above code is entirely in the movie _level0.menu for organization.
Code:
if (menu.sel == "games") {
if (menu.games == "0") { menu.games_mc.gotoAndPlay("_over"); }
if (menu.movies == "1") { menu.movies_mc.gotoAndPlay("_out"); }
if (menu.artwork == "1") { menu.artwork_mc.gotoAndPlay("_out"); }
if (menu.yugi == "1") { menu.yugi_mc.gotoAndPlay("_out"); }
if (menu.about == "1") { menu.about_mc.gotoAndPlay("_out"); }
if (menu.links == "1") { menu.links_mc.gotoAndPlay("_out"); }
menu.games = "1";
menu.movies = "0";
menu.artwork = "0";
menu.yugi = "0";
menu.about = "0";
menu.links = "0";
}
... and again, this repeats for every section's tab with the appropriate "1" and "0" setting.
I've finally got the animation and MouseOver events done - all I need is a MouseUp event! Can anyone help me figure out why it doesn't accept MouseUp or OnRelease events? Reference files can be provided if they are needed. Thanks so much!
This is, of course, a work in progress. A few artifacts of testing:
* The green squares on the left of each tab are invisible buttons to activate my rollover. I wanted to see them during testing.
* The blue rectangles sometimes visible over the tabs' text was a theory gone wrong; I was hoping I could click those rectangles, which are buttons (which would be invisible) to initiate the MouseUp event instead of the actual tab, which is a movie clip.
* Needless to say, graphics are temporary! LOL
* Coding is also not optimized yet, so it's a little messy for now.
Thanks again!!! Any help would be appreciated.
[advice] Trying To Create 2D Circular Nav Object
Hi
i will try and be as brief as possible.
i have been asked to create a nav which is essentially a circle (2D) that when 'idle' reacts very gently to mouse movement by rotating slowly.
on the circle is 4 segments/buttons that when hovered, pauses the movement of the circle and highlights the segment.
when the segment is 'clicked' the circle spins to align the segment with the top on the circle.
at this stage sub nav will be produced, but that i can handle!!
i have posted a very quick rough idea of what i am trying to create here:
http://www.visualrythm.com/spinning.gif
i have found some source code which i might be able to butcher, and if all else fails i can think of a very labourious and somewhat backward way of making it.....
but im hoping one of you masterminds out there will either have some source code, or can point we toward an example that can acomplish this?!
help
Create An Object When A Certain Movieclip Is On Stage
Hello all,
Currently, I have a few movieclips on stage. These movieclips are animated, and will show up on stage depending on the animation. For example, one could show up starting on frame 5, and the next coudl show up starting on frame 8.
These movieclips will be passed into my classes when I create a new object. As I am putting all of my code in a document class, the code will get executed once the movie finishes loading. In this case, any objects created that are passed the movieclips which are not yet on stage will toss a nasty error.
I am thinking about using ADDED_TO_STAGE to listen when these objects are on stage, and then create the objects.
In that case, how would i be able to listen for that event? Would i have to attach the listener to the movieclip i m listening for?
Cheers
Is There A Way To Create An Object Based On A String Value?
Hi people!
I have a set of buttons that dispatch an event when clicked on. One thing im kind of struggling with is to create a new object based on button clicked.
If i click on contact us, i need to load up the contact us module. However im not really sure how to do this without hard coding the values.
an example of hard coding the issue i mean:
private var menuArray:Array = ("option1", "option2", option3");
.... on the buttons when clicked i dispatch a custom event
private function onClick(c:CustomEvent): Void
{
switch (c.id);
case 0:
currentSection = new Option1();
break;
// and so on and so forth
}
Is there a better way to go about this?
Thanks
[advice] Trying To Create 2D Circular Nav Object
Hi
i will try and be as brief as possible.
i have been asked to create a nav which is essentially a circle (2D) that when 'idle' reacts very gently to mouse movement by rotating slowly.
on the circle is 4 segments/buttons that when hovered, pauses the movement of the circle and highlights the segment.
when the segment is 'clicked' the circle spins to align the segment with the top on the circle.
at this stage sub nav will be produced, but that i can handle!!
i have posted a very quick rough idea of what i am trying to create here:
http://www.visualrythm.com/spinning.gif
i have found some source code which i might be able to butcher, and if all else fails i can think of a very labourious and somewhat backward way of making it.....
but im hoping one of you masterminds out there will either have some source code, or can point we toward an example that can acomplish this?!
help
Create A Listener For Shared Object
I'm trying to create a shared object, save object data, and assign a listener to fire a function when the flush method fires and returns success.
I've looked at the docs and none of them seem to work for me.
The all talk about the OnStatus = function(infoObject:Object) method but all I need to do is check the system message returned by the flush method being invoked and write a function that captures the sharedObject.flush.success status and fires.
Can some please help...this is driving me crazy.
Create Link For My Flash Object
i have a flash object and i need to create one hyperlink when people click the flash object. any idea how to do this?
i've tried to use <a href-"..."> flash object </a>
but it fails to do so, any ideas? thanks.
below is my source code for the flash object.
Code:
<OBJECT codeBase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0"
height="153" width="779" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" VIEWASTEXT>
<PARAM NAME="_cx" VALUE="20611">
<PARAM NAME="_cy" VALUE="4048">
<PARAM NAME="FlashVars" VALUE="">
<PARAM NAME="Movie" VALUE="images/test/Movie1.swf">
<PARAM NAME="Src" VALUE="images/test/Movie1.swf">
<PARAM NAME="WMode" VALUE="Window">
<PARAM NAME="Play" VALUE="-1">
<PARAM NAME="Loop" VALUE="-1">
<PARAM NAME="Quality" VALUE="High">
<PARAM NAME="SAlign" VALUE="">
<PARAM NAME="Menu" VALUE="-1">
<PARAM NAME="Base" VALUE="">
<PARAM NAME="AllowScriptAccess" VALUE="">
<PARAM NAME="Scale" VALUE="ShowAll">
<PARAM NAME="DeviceFont" VALUE="0">
<PARAM NAME="EmbedMovie" VALUE="0">
<PARAM NAME="BGColor" VALUE="">
<PARAM NAME="SWRemote" VALUE="">
<PARAM NAME="MovieData" VALUE="">
<PARAM NAME="SeamlessTabbing" VALUE="1">
<PARAM NAME="Profile" VALUE="0">
<PARAM NAME="ProfileAddress" VALUE="">
<PARAM NAME="ProfilePort" VALUE="0">
<PARAM NAME="AllowNetworking" VALUE="all">
<PARAM NAME="AllowFullScreen" VALUE="false">
<embed src="images/test/Movie1.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer"
type="application/x-shockwave-flash" width="779" height="153"> </embed>
</OBJECT>
Is There Some Way To Create My Own Custom Event Firing Object?
I have CS3. I was wondering if there might be some built-in component or class which can help me launch a series of events to synchronize with a movie. I've considered using FLVPlaybackCaptioning, but I can't seem to get that component to trigger the captioning events without actually rendering them on my movie. I don't want those captions on my movie - I want to perform a variety of customized actions depending on the frame (or current time) of an FLV file. Also (and perhaps more importantly) I need these events to have considerably more data than just a name, some text, and a duration. I also need parameters like x, y, height, width, etc which I expect to define in XML or some other structured data object.
Is there some easy way to do this? I've considered parsing all of my XML at first and creating a series of timers, HOWEVER I'm not sure this will work because someone might pause the movie in which case I'd have to cancel all those timeouts and recreate them all when the movie starts.
In the meantime, the FLVPlaybackCaptioning thing is *almost* exactly what I need but not quite. As I mentioned before, I can't find a way to get the FLVPlaybackCaptioning events to fire without the captioning object molesting my FLVPlayback with its ugly captions.
'new' Keyword To Dynamically Create An Object Instance
Hi,
I was just wondering if the following is possible. Can I dynamically create new instances by passing in the type of object I want to create:
Consider the following pseudocode:
Code:
var typeOfThing:String = figureOutWhatToCreate();
// 'newThing' is the superclass of the typeOfThing I am trying to instantiate.
var newThing:[superclass] = new [typeOfThing] (param1, param2...);
Or, does the parameter after new need to be a class object ? I know that the above code doesn't work because I've tried it, but I guess I'm asking of it is possible through other means.
I just have a huge switch statement that I am trying to do away with. If this is a totally stupid question, just tell me to forget it altogether and keep the switch.
Thanks in advance,
Create An Object Of A Class 'stored' On A String
Hi list, I know this could not be a good practice, but I really don't know any other way. I need to call a class dynamically
I need something like this:
ActionScript Code:
var classname:String = 'class123';
var myobj:classname = new classname();
Is possible? how?
TIA
Create Embedded Video Object With Actionscript
The only way I know how to create a video object for playing progressive FLV is by going to the libraby panel and clicking the context menu, then new Video, and dragging the video object to stage. But I would like to know if there is way to create a Video object with actionscript at runtime. Any ideas?
Create An Array Object As A Member Of A Movieclip
Hi all
I'm having trouble wrapping my head around creating an array as a data member of a movieclip, i.e. dynamically adding it to that movieclip depending on data brought in at runtime.
Is it possible? Would I have to create an array seperately first and then somehow assign it to a new (typeless) data member of the movieclip?
Thanks in advance for your help.
-Nick
How To Dynamically Create Object’s Trough For Loop?
Hi,
I want to dynamically create 10 Objects trough for loop. Each Object should have unique name.
In previous version od AS you could sove this with these lines of code:
Code:
for(var i:Number = 0; i<10; i++)
{
this["myObject" + i] = new Object();
}
How to do this in AS3?
Code:
for(var i:Number = 0; i<10; i++)
{
var myObject:Object = new Object(); //How to setup uniqu Object name?
}
Thanks,
Simple Problem. How Can I Create An Ac3 Object In Mxml?
Hi!
I want an ac3 object in my mxml.
I have an error in this code. I haven't connect until now ac3 and mxml, I think the problem is very simple.
1084: Syntax error: expecting identifier before doubledot.
<mx:Application
xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:comp="../ptest.*">
<mxanel title="Tutorial" width="300" height="200">
<comp:Sdd id="pl" />
</mxanel>
</mx:Application>
The ac3 class:
package ptest
{
import flash.display.SimpleButton;
import flash.display.Sprite;
public class Sdd extends Sprite
{
public function Sdd()
{
this.addChild(new SimpleButton());
}
}
}
Shared Object To Create Last Visited Functionality
i'd like to use shared objects to set the time of the visit of a user to my site.
If they revisit I'd like to output : trace("you were here x seconds ago")
Ultimately I'd like to display different content if the visitor has revisited x seconds later...
Has anyone got any idea how to do this? I wrote a huge AS section into my code then ripped it all out because it didnt work
I'm almost at my wits ends with it
[shared Object] Will Not Create Cookie.txt File
Last edited by iaustin : 2005-12-12 at 12:38.
I'm creating a checkmark project. based on stored shared objects a checkmark is placed on the screen next to an index indicating this subject has been visited. The code is executing but, the so.flush() method is actually replacing my values with new/or the latest ones. If i select all three subjects they are correctly written to the so. However, if I reenter the checkmarked screen and make new selections the new selection overwrite not append to the so.
so.clear actually removes the entire so from my drive. so.flush is doing almost the same thing, except it is replacing the data.
What am I possibly doing wrong.
//---begin cookie
so_IOC = SharedObject.getLocal("philosophy2");
fget();//cerate & INT@startup//get from so cookie array at startup
arrcheckmark = new Array();
function fset(choice) {
arrcheckmark.push(choice);
vCookieData = arrcheckmark;
vset = so_IOC.data.vCookieDate4=vCookieData;
//so_IOC.flush();
}
function fget() {
vget = so_IOC.data.vCookieDate4;
for (j=0; j<=4; j++) {
fcompare();
}
}
//=== condition
function fcompare() {
arrcompare = [0,1,2,3];
for(i=0; i<=4; i++){
trace("vget[j]@ compare====="+ vget[j]);
if (vget[i] == arrcompare[j]) {
_root["checkmark"+j]._x = checkmarkposition;
//place checkmarks
break;
}
}
//loop
}
//===end condition
//save cookies for exit
function fsave(){
so_IOC.flush();
}
//clear all cookies data, refresh
function fclear() {
so_IOC.clear();
//clear
}
//--- end cookie
How To Create A Springly Effect On An Object Attached To A String
Yeah really in need of help. I've look into the tutorial on how to create a springly effect on an object but it applies only in Flash 5 and not in MX. The problem is i manage to get 1 object to have a springly effect but the other objects just cant seem to move due to the startDrag function or the OnClipEvent. help me....
Secondly , i have an object attach on a curve line and when this object is pull i want one end of the line to stretch and follow the object while the other point stays at its original position. This create an extended straight linehow?
How To Create A Springly Effect On An Object Attached To A String
Yeah really in need of help. I've look into the tutorial on how to create a springly effect on an object but it applies only in Flash 5 and not in MX. The problem is i manage to get 1 object to have a springly effect but the other objects just cant seem to move due to the startDrag function or the OnClipEvent. help me....
Secondly , i have an object attach on a curve line and when this object is pull i want one end of the line to stretch and follow the object while the other point stays at its original position. This create an extended straight linehow?
Create Object To Scale Based On Users Input
I'm trying to create a virtual classroom in Flash MX. People will be able to drag and drop lab items into the room to create a classroom. I want to have 2 form fields for Width and Length of the room in feet. (1 square foot will be 9x9 pixels.) When visitors enter their room in width in feet and length in feet, I want the flash movie to show a rectangle to scale.
You can view a rough mockup diagram at this URL: http://www.marcellas-reynolds.com/ss.jpg
Can anyone help with this? I have had no success looking for help from other resources.
Thanks in advance.
Create A Perimeter Around An Object That Detects The Mouse And Triggers An Effect
I have my main movie called "base.fla". On "base" I have my logo at the upper right corner. It was a graphic symbol, I converted it to a movie clip called "tri".
What I want to happen is when the mouse pointer enters the perimeter of "tri" I want the _alpha action to take affect. The closer the mouse is to "tri" the lower the percentage of _alpha there will be on "tri". Kind of like a motion sensor. If the mouse pointer is X amount of distance from "tri", then "tri" will be X amount _alpha (higher or lower percentage) depending on the mouse's distance from "tri".
Say the mouse pointer is 200pt from "tri", then "tri" would be at 100% _alpha, meaning that 200pt marks the edge of the perimeter. If the mouse pointer was at 100pt from "tri", then "tri" would be at 50% _alpha.
-Thanks
|