How to create a movie clip during runtime?
I'm learning basic shooter games and my goal is to have a small circle movie clip (would it work as a movie clip?) spawn when the mouse button is pressed. I know how to add the code for the button being pressed, but I do not know how to create the object on demand. Can you please help me with this?
For AS2, you right click the movieclip symbol in the library and select the Linkage... option. In the panel that appears you select the first option (Export for Actionscript) and another is automatically selected. Then you assign an Identifier for it in the field at the top. To add that movieclip to the stage you use the attachMovie() method... for example...
this.attachMovie("linkageIdentifier", "instanceName", this.getNextHighestDepth());
In AS3 it is somewhat similar as far as assigning an Identifier, except you assign a Class name instead, and then add a new item to the stage as a new instance of the class...
var instanceName:ClassIdentifier = new ClassIdentifier();
Similar Messages
-
How to create Confirmation Item QUANTITY during Runtime
Hi Experts,
I am trying to create Confirmation ITEM with QUANTITY during runtime.
I have successfully created item using CRM_ORDERADM_I_MAINTAIN_OW however it doesnot have scheduling_i structure which hold QUANTITY. I tried with CRM_ORDER_MAINTAIN_MULTI_OW. getting following error, I tried with CRM_SCHEDLIN_I_READ_OW it creating quantity on CRM Confirmation screen.
Can you pls tell me how to get quantity.
Thanks
Anee
The current application program detected a situation which really
should not occur. Therefore, a termination with a short dump was
triggered on purpose by the key word MESSAGE (type X)
ls_fund_h TYPE crmt_fund_h_com,
ls_cla_h TYPE crmt_cla_h_com,
ls_lawref_h TYPE crmt_lawref_h_com,
lt_lawref_h TYPE crmt_lawref_h_comt,
ls_orderadm_i TYPE crmt_orderadm_i_com,
lt_orderadm_h TYPE crmt_orderadm_h_comt,
lt_chngproc_i TYPE crmt_chngproc_i_comt,
ls_chngproc_i TYPE crmt_chngproc_i_com.
DATA:
ls_entry TYPE crmt_guid_handle,
lv_dummy TYPE crmt_msgtext,
lv_vona_kind_copy TYPE crmt_boolean,
lv_count TYPE i,
ls_msg_handle TYPE balmsghndl,
ls_exception TYPE crmt_exception_logical_ke
lv_subrc TYPE sy-subrc.
FIELD-SYMBOLS:
<ls_order_item> TYPE crmt_order_items.
* check correct call
ADD 1 TO gv_recursive_call.
ADD 1 TO gv_maintain_active.
CALL FUNCTION 'CRM_ORDER_CHECK_RECURSIVE_OW'
EXCEPTIONS
recursive_call = 1
call_without_order_maintain = 2
OTHERS = 0.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
EXIT.
ENDIF.Did you solve the problem?
-
How to update cgicmd.dat file during runtime?
I'd like to know how do update cgicmd.dat file during runtime. For example, I run a report one.jsp as
http://<machine>:<port>/reports/rwservlet?one.jsp&USERID=uid/pwd@db&DESTYPE=cache&mode=bitmap&desformat=htmlcss
within this report there is a hyperlink to open another report named two.jsp.
before creating this hyperlink, I'd like to update cgicmd.dat file with passed in userID, pwd, and connection, so two.jsp can use this key for userinfo
so I can create hyperlink as follows
srw.set_hyperlink('/reports/rwservlet?report=two.jsp'||
'&cmdkey=userinfo&DESTYPE=cache&mode=bitmap&desformat=htmlcss');
ThanksTo my knowledge the cgicmd.dat is only read when the OC4J starts, so you would have to come up with another solution. Using Single-Sign-On (SSO) is quite a good idea, and it's there for cases like this.
Regards,
Martin Malmstrom -
Trying to create a movie clip that Bounces off four sides of the stage
using the syntax below I have created a movie clip called 'BALL' that bounces off from the left "x" and moves to the right side of the stage 'x.520' and bounces back to the start "x".
HOW DO I CREATE A MOVIE CLIP THAT BOUNCES FOUR SIDES OF THE STAGE AND STOPS ON THE FOURTH BOUNCE??
var ballTween:Tween = new Tween(ball, "x", Bounce.easeInOut, ball.x,520, 5, true);
ballTween.addEventListener(TweenEvent.MOTION_FINISH,tweenFinishedF);
function tweenFinishedF(e:TweenEvent):void{
new Tween(ball,"x",Bounce.easeOut,ball.x,0,5,true);Here is a simplest way to do that. This code doesn't use your ball but draws it dynamically. If you want to use your ball instance - replace relevant lines.
import flash.display.Shape;
import flash.display.Sprite;
import flash.events.Event;
import flash.geom.Rectangle;
var ball:Shape;
// speed, naturally
var speed:Number = 7;
// velocity along x
var vx:Number = speed;
// vlocity along y
var vy:Number = speed;
// area within which ball may move
var moveArea:Rectangle;
// radius of ball circle shape
var ballRadius:Number = 20;
init();
function init():void
moveArea = new Rectangle(ballRadius, ballRadius, stage.stageWidth - ballRadius, stage.stageHeight - ballRadius);
drawBall();
addEventListener(Event.ENTER_FRAME, moveBall);
function moveBall(e:Event):void
// change direction if ball moves out of allowed rectangle
if (ball.x < moveArea.x)
vx = speed;
else if (ball.x > moveArea.width)
vx = -speed;
if (ball.y < moveArea.y)
vy = speed;
else if (ball.y > moveArea.height)
vy = -speed;
ball.x += vx;
ball.y += vy;
function drawBall():void
ball = new Shape();
ball.graphics.beginFill(0xFF0000);
ball.graphics.drawCircle(0, 0, ballRadius);
ball.x = moveArea.x + Math.random() * moveArea.width;
ball.y = moveArea.y + Math.random() * moveArea.height;
addChild(ball);
Message was edited by: Andrei1 -
How do I transfer movie clips from iPhoto to iPad?
How do I transfer movie clips from iphoto on my iMac, to my iPad?
You can use a USB flash drive & the camera connection kit.
Plug the USB flash drive into your computer & create a new folder titled DCIM. Then put your movie/photo files into the folder. The files must have a filename with exactly 8 characters long (no spaces) plus the file extension (i.e., my-movie.mov).
Now plug the flash drive into the iPad using the camera connection kit. Open the Photos app, the movie/photo files should appear & you can import.
Cheers, Tom -
To create unlimited movie clip
How do I create unlimited movie clips by CreateMovieClip by onPress a button ?
Here is a simplest way to do that. This code doesn't use your ball but draws it dynamically. If you want to use your ball instance - replace relevant lines.
import flash.display.Shape;
import flash.display.Sprite;
import flash.events.Event;
import flash.geom.Rectangle;
var ball:Shape;
// speed, naturally
var speed:Number = 7;
// velocity along x
var vx:Number = speed;
// vlocity along y
var vy:Number = speed;
// area within which ball may move
var moveArea:Rectangle;
// radius of ball circle shape
var ballRadius:Number = 20;
init();
function init():void
moveArea = new Rectangle(ballRadius, ballRadius, stage.stageWidth - ballRadius, stage.stageHeight - ballRadius);
drawBall();
addEventListener(Event.ENTER_FRAME, moveBall);
function moveBall(e:Event):void
// change direction if ball moves out of allowed rectangle
if (ball.x < moveArea.x)
vx = speed;
else if (ball.x > moveArea.width)
vx = -speed;
if (ball.y < moveArea.y)
vy = speed;
else if (ball.y > moveArea.height)
vy = -speed;
ball.x += vx;
ball.y += vy;
function drawBall():void
ball = new Shape();
ball.graphics.beginFill(0xFF0000);
ball.graphics.drawCircle(0, 0, ballRadius);
ball.x = moveArea.x + Math.random() * moveArea.width;
ball.y = moveArea.y + Math.random() * moveArea.height;
addChild(ball);
Message was edited by: Andrei1 -
How to play a movie clip with a tween animation
I created a movie clip symbol with a tween animation and created an instance of it on the main stage. The animation is in the movie clip timeline, not on the main timeline. I cannot get the mc to play using mc.play() or mc.gotoAndPlay. What am I missing??
Hi Ned, thanks for the response;
1.Yes I named the instance.
2.I don't beleive so. I started from the library creating a new symbol, added the graphics, added the key frames, then created the tween. Then I dragged the symbol onto the main stage and named the instance. So I don't think there is a movie clip inside an mc.
Here is the main timline:
Here is the mc timeline:
Here is what I'm trying to do:
stop();
blk1._visible = false;
blk2._visible = false;
blk3._visible = false;
ppk1._visible = false;
ppk2._visible = false;
ppk3._visible = false;
storeCartons = new Array();
storeCartons = [blk1, blk2, blk3, ppk1, ppk2, ppk3];
startButton.onRelease = function() {
myNumber = Math.floor(Math.random()*storeCartons.length);
trace("myNumber "+myNumber);
activeCarton = storeCartons[myNumber];
activeCarton._visible = true;
activeCarton.play(); -
How can i change/create F1 doku text during runtime
Hi everybody,
I have a problem.
During runtime the user should be able to create a documentation. This documentation must be stored in the F1 help of a data type.
It's easy to get the created help text out of the F1 help.
But is there any possibility to set the help text of a data type during runtime without calling and displaying the document maintenance initial screen?
Can anybody help me?
Thanks & RegardsHi Max,
thank you for your answer. But I think I don't realy understand.
The documentation should be created for a pattern which is created by the user. I just schould be stored in the F1 help of a data type.
So there is no field on the screen for which i can use this event.
Is there a function or something like this i can call to open the document maintenance starting with the "change" screen?
Thanks & Regards,
Christian -
How do I recerence Movie Clips on the Main Timeline from inside a class?
Hey everyone, this might be a stupid question but I thought
I'd ask cause it's making me nuts. I'm all of 2 days into AS3
(coming from not using Flash at all in YEARS) so feel free to
consider me ignorant. I do have plenty of application development
experience in other areas though.
I can't seem to create a class that can reference an instance
of a movie clip on my main timeline. I'd post code of what I've
tried but I've gone through so many desperate edits & wild
guesses that it was just garbled junk before I deleted it all.
Basically here's how I figured Flash could work, though maybe
it doesn't work this way at all.
I'm assuming that with AS 3 being so big on being a true
object oriented environment, I wouldn't need to mix my code and
interface together. Preferably I'd be using the Flash authoring
tools just to design my interface. Create a button... place it
somewhere... give it an instance name. Roughly the equivilant of
Apple's InterfaceBuilder for those of you that might be familiar
with Cocoa development. I can see maybe having to put a few lines
of ActionScript onto frame 1 (though really I'm hoping Flash would
have a better method of kicking off the application at this point
that using code tied to frames) to load my classes & such, but
after that I'd like all of my code to be held in external class
files.
So maybe I've got:
Interface.fla - My interface
Button_1
Button_2
TextField_1
Main.as - My main controller class using to handle all of my
applications behavior
SomeClass.as - Some helper Class
SomeOtherClass.as - Some helper Class
Main.as would have instructions in its initialization method
to go ahead & attach events to buttons & initialize
anything else that needs to happen when the application starts.
From there on it would all be objects communicating back &
forth. Button_1 would get clicked with would fire
Main.someMethod(). Main.someMethod() would then do it's thing and
set the value of TextField_1. All very clean & code is very
separated from interface.
Unfortunately I can't for the life of me figure out how AS3
classes reference each other like that. There doesn't seem to be
any kind of a global 'root' or '_root' I can use to locate any
movie clips on the stage. I've searched the help & the web for
any kind of simple tutorial but to no avail. My job has tasked me
with building a flash app for a project but I'd really rather not
have a tone of ActionScript just shoved into frame 1. That just
seems... ugh! (::shudder::)
Can someone maybe point me in the right direction here? I'm
really willing to do my homework but I can't seem to locate the
info I need to get started. Also, is there an ActionScript IRC
channel or something maybe?
Thanks,
CliffI worked with the problem last night and the solution I
started coming to involved creating my own custom document class
based off which extends MovieClip. My thought is that way I have
access to the initialization routine of the timeline itself and
that all of the elements on the main timeline should be
"properties" of my custom class.
Is this correct? Is there a down side to doing this & if
so what is it & why?
Also, just for my reference, the last time I did anything
with ActionScript I think I was using '_root' to target the main
timeline. WHat are the global variable names in AS 3? Is it just
'root' & 'stage' or 'Root' & 'Stage' or what? -
How to create a text object at runtime?
Hi,
I am using crystal reports for visual studio 2010 and using c# to programming.
I need to create a text object in a specific section like section 2. and also I need to control the text object's position and text.
I tried to move a object like:
reportDocument1.ReportDefinition.Sections[j].ReportObjects<i>.Left = 0x8760;
but object's position doesn't change at all.
How can I do these (create a text object and change a object postion)?
ThanksHi Don,
Thank you.
I have downloaded a RAS ( report application Server ) sample.
The sample uses the Business Objects Enterprise XI release 2. I am using win 7 and crystal reports for vs2010. Can I use this version of crystal reports to create a text object at runtime? If not, what is the lowest version I have to purchase to achieve what I want?
Basicly I need following capabilities at runtime:
1) craete text objects, line objects, image objects.
2) change text object, line object and image object positions, sizes, values of text object. If can I like to be able to change font as well.
3) supress objects, sections.
4) change section's height -
Hi,
On the main timeline, I have the following code:
external_btn.addEventListener(MouseEvent.CLICK, showMenu);
function showMenu(e:MouseEvent):void
var myMovieClip:MovieClip = new Member();
addChild(myMovieClip);
myMovieClip.x = 597.95;
myMovieClip.y =359.15;
in the internal movie clip, that I linked it to Member:
In the member movie clip, I have the following code to remove the movie clip that was created in the main timeline of the root movie clip.
release1_btn.addEventListener(MouseEvent.CLICK, goBack1);
function goBack1(e:MouseEvent):void
MovieClip(root).removeChild(myMovieClip);
I received the following compiler error:
1120: Access of undefined property myMovieClip.
Please help me know how to resolve this error message.
Thanks,
Robert.that's (coding on more than one timeline) not good coding style, but this will correct your error and the prevent a few more:
release1_btn.addEventListener(MouseEvent.CLICK, goBack1);
function goBack1(e:MouseEvent):void
MovieClip(this.parent).removeChild(this); -
How to email a Movie Clip in Flash
Hi everyone.
I am creating a painting / drawing application in flash.
I want to add a functionality, which allows the user to send his/her painting to his/her email address.
How can this be done?
Please note that the painting / drawing would be a movie clip
Help on an urgent basis would be greatly appreciated
ThanksHi,
I did something similar for AS2:basically there was a "designer" swf where one could interact to create a design,
and a "viewing" swf that contained all the bits and pieces used (e.g. a blank t-shirt).
The designer swf would send data (placement of objects, coordinates of strokes) to the server, and the server would amend the blank viewer swf by compiling the data object and adding it as another code block. The code of the viewing swf would handle constructing the desired image, by placing objects, adding strokes, etc.
With the simple structure of AS2 code, php could do that.
I sort of believe that something similar could be done for AS3 if the server is able to run java (the flex sdk programs). Addition: PHP by itself should be able to replace an embedded text file ... such as an xml description of the artwork -
Dreamweaver CS4 How to play a movie clip by clicking an image
Hi
Can anyone recommend a DW Behaviour, Widget or simple piece of Javascript coding that would allow me to start (or start and stop) a movie clip by clicking an image.
I have a web page created in DW CS4 which has 4 FLV video clips and I would like visitors to be able to start their clip of choice by clicking a small still from each movie stacked at the right side of the page.
I've seen this done on many sites but don't know how complex it would be.
Any help / advice much appreciated.
Thanks
GeorgeHi Ned, thanks for the response;
1.Yes I named the instance.
2.I don't beleive so. I started from the library creating a new symbol, added the graphics, added the key frames, then created the tween. Then I dragged the symbol onto the main stage and named the instance. So I don't think there is a movie clip inside an mc.
Here is the main timline:
Here is the mc timeline:
Here is what I'm trying to do:
stop();
blk1._visible = false;
blk2._visible = false;
blk3._visible = false;
ppk1._visible = false;
ppk2._visible = false;
ppk3._visible = false;
storeCartons = new Array();
storeCartons = [blk1, blk2, blk3, ppk1, ppk2, ppk3];
startButton.onRelease = function() {
myNumber = Math.floor(Math.random()*storeCartons.length);
trace("myNumber "+myNumber);
activeCarton = storeCartons[myNumber];
activeCarton._visible = true;
activeCarton.play(); -
Create container movie clip and child clips at design time?
It's always powerful and dynamic to use
"createEmptyMovieClip" and "attachmovieclip" at run time. But how
to create this relationship of clips at design time so that an
empty movie clip can hold several child movie clips?
Thanks!Thanks!
I'm sorry I asked a confusing question. I know how to create
container clip using AS (as you post above). Then, somehow, I think
how to put an empty clip on the stage and then add clips to it as
children or grandchildren from design panels at design time... Will
this have the same effect as using AS (createEmptyMovieClip and
attachMovieClip) in terms of handling events? I guess a container
clip will be overwritten by its child and as a result it won't
response to events. Is this correct? -
How do I backup movies/clips to use in future projects?
After burning my first DVD & deleting the iMovie file, I was sad to discover that I could not just pop the DVD into my drive & access the material to use in future projects. (Is there a way to do do this that I don't know about?)
I'm guessing I need to burn the archived iMovie file onto multiple regular CDs (I have not burned anything that spans several CDs before). This is confusing me because the zipped file is hardly smaller than the original (Is there a better zip program than the one that comes with this system?) I threw away the wrapper for my blank CDs so I don't know how much they hold but I think it is something ridiculously small like 670MB and the iMovie file is 7GB. Is this the only way to save my movie/clips so that I can bring clips into a future movie?
1.8 GHz Power PC G5 Mac OS X (10.3.9) 256 MB DDR SDRAMwelcome Novice to the board ....
hmm, multidimensional question ...
DVD is end-of-the-road, not meant for further processing; there are tools, allowing to import DVD to iM, but that is a time-consuming and lossy (=losing pic quality) process, due to the deliver-format nature of DVDs.... search forum for "DVD import"
iM is by concept not meant to handle a clip in many projects (that can easily been accomplished with pro tools as FC(E), which offer "bins" for imports, offering the content to many sequences/projects).
there are workarounds, dragging clips from the internal files of an iM project to another... but, as said: you "fumble" the concept: import tape, edit, burn - done.
a video contains ~13GB of data per hour... and, video is allready highly compressed, no zipper can reduce that dramatically... and, you risk damage of files... yepp, a cd-r fits ~700MB = 3.5min of video......
recommended workflow:
* don't store iM projects on -r media (cd/dvd), but firewire connected harddrives..
* keep the tapes; import clips from tape into project; you can export single clips out of iM/import into another project, I wouldn't do that with "lots" of clips, importing the tape is... more convenient..
Maybe you are looking for
-
Kay Say for example i had: public int[] i d= new int[3]; {code}And i[0] was set to 3, i[1] was set to 5, i[2] was set to 4, and i[3] was set to 1. Basically in easier terms: {code:java} i[0] = 3; i[1] = 5; i[2] = 4; i[3] = 1; {code}Right, how would i
-
Notification objects entry problem
Dear all, my client needs to enter multiple functional locations and equipment to the pm notification. is it possible and in which tab? i know similar tab in order but can not find in notification... thanks
-
Service Entry: No message Output
Hi, I created some new purchasing groups and it run well until the release strategy of PO. But after I created service entry and accepted it, it said that 'no message output', and I can't print the entry sheet through ML83 (it said 'no suitable purch
-
To create bapi?(function module for bapi i.e. checks and update table)
Hi all, I want to know how to create BAPI?. means in function module how i hv to put checks and how i will update database table. thanks and regards sg
-
Local_domains.db duplicate entry
Hi everyone, I'm seeing the following error repeated every so often in my SMTP log: Dec 28 12:45:14 rocking-mm.com postfix/postmap[19452]: warning: /Library/Server/Mail/Data/scanner/amavis/local_domains.db: duplicate entry: "rocking-mm.com" I'm not s