Flash :: Objects Still Created When Omit Importing Classes?
Oct 2, 2011
I'm working through a tutorial to create an mp3 player in actionscript. When I delete my first 4 lines of code, the .swf still works great! I thought you needed to declare what classes you're importing for every object you create later on.
I'm trying to import a class from a class that is located in another folder. How do you move up a directory? Using./ or ../ doesn't seem to work. Essentially I want to access a TweenLite Class but not from the document class. My class is at com/myName and the class I want to access is at com/TweenLite. import ../TweenLite doesn't work... I realize I could just copy and paste the entire Tweenlite folder again, but there's got to be a less duplicative way of doing this..
Flash, for whatever reason has completely stopped allowing my external files to communicate with one another. In order to confirm this I ran a few tests. I have two very simple actionscript files Main.as and TestDialog.as.
Every time i run my program it throws error 1180 method test possibly undefined.If i try and run the constructor function TestDialog() i get the incorrect number of arguments error.
One of my main interests is playing games so I thought why not make a game? I see lots on the Internet games based in Flash so I thought that would be my best starting point to make actual graphic based games... (not to mention I actually got taught at university how to use flash to a certain extent). The game I decided upon was tetris. I'm sure you're all familiar with the block based puzzle game and might be able to shed some light upon what I am doing right and what I am doing wrong. So, I've firstly made my game screen with a window for all the blocks to come down in.
I've also put some dynamic text place holders ready for when I come to keeping track of how many 'lines' the player has scored, the time and so on in the right hand side of the screen. I have made graphics for the different colour 'building blocks' (just one block of 24x24 in different colours for each shape) and then used the 'building blocks' multiple times to create my shapes (I, J, L, O, S, T, Z). These blocks are called tetrominoes. Now I've come to a point where I need to import these tetrominoes randomly from the library and get them to appear in the middle just off the top of my block screen.
How do I import random objects from a particular folder in my library to the stage in Flash CS5 AS3? After realising a quick solution to my problem was not to be found quickly I then thought about what will happen to this block once it has been imported... Well, in Tetris the block moves slowly down until it hits another block or the bottom of the block screen. I know that I can do something with a detectHit() function. How do I get my block to move down the screen by a set amount of pixels every second or so?
If I have a form with 12 text input fields on one page and on another for a different reason I have 4 text input fields how do I keep this information form the 4 from being passed to my php script?
I have a project that I want to import an external class (Caurina) I have the folder on my desktop and I'm trying to find out how to import and where in Flash do I do this. I got as far as looking for the folder in the publish settings tab (Mac)
I'm having some problems with importing classes in AS3. I'm kinda new to flash and programming in general. I searched on these forums and couldn't find anything in regards to importing an external class. I'm trying to import the tweener class and I used the code: import caurina.transitions.Tweener; on the first frame of the symbol I'm trying to load the class in. But I get a syntax error and an error that says "statement must appear within on/onclipevent handler".
So i a building a categorized menu of different foods. I have a class for "categories" (buttons) which essentially will return a string "salads", "drinks", etc. I now have another class "menuItems" for items within categories and this handles sizes such as "small", "med", "large", etc. My problem now is that when i return "salads", i want to invoke an array which contains all the elements of salads, send it to menuItems which will populate the menu. So far i have both the category objects and the menu object setup. I just cant seem to be able to send the data that the category object is returning and pass it to the menu object. Both of which are added to the stage as shown below:
If there was a way that i could say add all these classes to one class so that they can talk to each other that would be great but i dont know how to do this.
I'm creating mc's during runtime like this: for (var i:Number = 1; i <= pictures; i++) { this.attachMovie("box_mc", "box" + i+ "_mc", this.getNextHighestDepth()) }
So, if pictures is 5, then we end up with 5 boxes, box1_mc, box2_mc, box3_mc and so on. But I can't work out an easy way to refer to them later on. For example, say someone presses a button and I want to move all of them - how can I set their _x value in a loop? For example, if I wanted to move all of them 100 pixels, then this wouldn't work: for (var i:Number = 1; i <= pictures; i++) { "box"+i+"_mc"._x = "box"+i+"_mc"._x - 100; }
iam in a situation to convert the dynamically created objects( just movieclips which contains boxes,texts etc) in flash using AS3 to .DWG format. i tried converting the flash objects in to SVG format , then tried to open it in Auto Cad , but the texts are not editable in auto Cad;
What is the difference between importing a class and extending a class, I know that when you extend you add all the properties/methods of that class to your own class, but I am still un sure of what this actually does for you and your program, I am pretty confused on the topic and I couldnt find the difference between the two on the internet, also how do you know which one of the two you need to do?
I have 2 as3 files, which are the classes used . I have to use it with the main flash movie.. How will I include those as3 files without using document class..
I'm having a problem with my preloader and importing Fuse classes.
[Code]...
When I simulate download, the State is Frame 0 and it doesn't trace(amount) or scale the bar_mc until it is 100% loaded. If I remove the Fuse import, it works as it should. What is the best way to fix this problem? Is there a way to fix it? I'm continuing to search for a solution, but thought I'd ask the knowledgeable folks here first.
Right now in my 3D work folder I have a long list of demos and benchmarks all importing classes from my rumblesushi3D folder (package rumblesushi3D), which contains my entire 3D engine.
It's too long and cluttered, and now that I'm about to start work on my first game, I'd like to put all my publishable work into folders - such as demos, benchmarks, then a folder per game.
The files in these new folders now need to import classes from the same 3D engine that's now in the previous directory (rumblesushi3D).
The only alternative is to place a copy of my 3D engine folder in each folder, which I obviously don't want to do.
Say for example, you have a FLASH_WORK folder, in this folder there is a com folder with all the classes you use. All the document classes of your work are in FLASH_WORK, so the same folder depth as com obviously, and are not assigned a specific package.
If you put all these document classes into a folder called archive (created in FLASH_WORK) for example, is there any way to import the classes from the same com folder, now at a previous depth, without renaming ALL the classes in com to [URL]etc etc ?
I was trying to build an application where a designer has created content on the timeline as a sequence of key frames. Each key frame is completely different. When the application is started I choose one of the frames, move the play head to that frame and stop (using gotoAndStop). Next, by referring to symbols in the key frame by name, I use AS3 to allow drag and drop, and I also do some programmatic movement.
The problem is that when I move to a different key frame on the timeline using gotoAndStop, the symbols that were touched by AS3 in the previous frame, even if they are not referenced by the designer's key frame, show up on the stage. It is as though any DisplayObject that I touch with AS3 becomes divorced from the timeline.
how to programatically work with timeline (MovieClip) content that was manually created by a designer. This just seems like it should be a really common use case. It seems that about the only thing I can do safely with the timeline is to move the play head and respond to events (if I don't change the state of DisplayObjects in the timeline). Also, is there any good documentation on how objects get allocated and destroyed when the timeline plays?
i'm creating an application using AS3.0 and class files. in this application i have a MovieClip in the library i'm using that contains several symbols and configurable textfields and have already defined the functionality for these symbols. my question is, if i'm creating an application and through actionscript and i'm spawning instances of a symbol, do i have to define the functionality and initialize this symbol in the main application class?
specifics: i'm creating a panorama app with markers that are papervision3d planes. they use a movieClip texture that i've created and i want to configure textfields and display pictures that describe the info in the marker. i created a panoApp.as class file that configures the panorama. but i also have a marker.as class that defines the symbol's behavior. this movieclip has symbols in it it's stage that i've defined (ie: name_textfield, description_textfield, etc..) when i compile the project, the compiler errors saying that the variables/identified internal symbols are missing.
I have a CustomSimpleButton class and a CustomSprite class which creates a bunch of CustomSimpleButtons and displays them at runtime. How can I access other objects on the stage in Flash inside of my two custom classes? If I want an object tween to occur when one of my custom buttons is clicked how do i reference the object that I want to tween if I'm inside of my custom class.
I'm currently working on a Flash platform game and I'm trying to make each level have its own class that defines a hitTest function (Each class is linked to the MovieClip of the level), which would allow the character to walk on the level. Whenever I try to import the subclass into the Document class, errors start popping up and it is driving me crazy (Error 1120: Access of undefined property)
Document Class (Class_Main.as): package {[code]....
I just started using flashdevelop and I have some problems with importing all classes.
1. I used export all classes to SWC file and I added it to the library in FD. How can I import instances placed on the stage without creating AS linkages? I don't want to export these instances for AS, because some of them are textfields. By making linkages I'm forced to transform them to Sprite or MovieClip (am I right?) and my methods connected to these object don't work anymore.
2. When I export my project in FD, I get error 1065: variable Main is not defined. Main is my document class. I made this class my entry in FD.
Suppose I have a Sprite (A) that is constanly being rotated (as often as the mouse moves).
I have another Sprite (B) that is a child of (A). It makes sense that B is a Child of A because I want B's position to be relative to A's position, and I want B to become invisible when A goes invisible, etc.
However, I would like B NOT to rotate when A rotates. Is there a way to omit B from rotating when A rotates, even though B is A's child?
I know I could do something like B.rotation = - A.rotation everytime A gets rotated, but that feels like a clunky hack to me... there must be a better way?
Currently I'm considering making B a separate object, and not a child of A. But thats not much better because then I have to keep B updated with A's position and visibility, etc...
i m working on flash offline application... i have a main file where i have hundreds of movieclips and sound clips to animate and run on the stage directly from libaray by "export for actionscript" and "export in fisrt frame". Everything is going well but the final swf file or projector file becomes very heavy and have problem runing on P2 system. so , is it possible that i could divide the assets of movie i.e. sound clips and movie clips on saprate files ... and i load these files into main file time to time during runtime .. and use there sound and movie clips from the main file script.. i only want to use the resources of other files for actionscript.
I am currently reading the Actionscript 3 Bible and the author shows an example in which a custom eventDispatcher class is created. When the class is later used in the code it's called as such:
//Thermometer is a custom eventDispatcher that extends the eventDispatcher class. var thermometer:Thermometer = Thermometer(event.target); //why no new keyword?
I'm a new programmer and I was curious if someone could explain how this works? Why is the new keyword omitted? When you omit the new keyword on a class that extends another class is it essentially just calling the superclass(eventDispatcher) constructor?
If I turn 'Omit trace actions' on, then when I run the file, I get the error that says: Stack underflow occurred.
Fortunately, it told me what class it occurred in, so I took out the traces one by one, and I found one particular line that causes the error. It's just tracing a string, and it causes the error anywhere inside of this one function.
So I can easily avoid the error, by either erasing that one trace, or by turning 'omit trace actions' back off. But I don't really get why it's happening.