Writing a Class for making the 'enemies' follow the 'player'...
Greetings;
I'm an actionscript beginner and trying to write a class to make the 'enemies' follow the 'player' (shown below). I'm trying to write it such that it takes two MovieClips as arguments, and moves the first one toward the second one. When I import the Class try to use it in Main.as by typing " var followPlayer:FollowPlayer = new FollowPlayer(fishMov0, player);", I get the following error:
"ArgumentError: Error #1063: Argument count mismatch on jab.enemy::FollowPlayer/followPlayer(). Expected 2, got 1."
Any ideas/suggestions would be appreciated.
Thanks,
Jeremy
package jab.enemy
import flash.display.MovieClip;
import flash.events.Event;
public class FollowPlayer
private var _clip1:MovieClip
private var _clip2:MovieClip
private var speed:uint = 1.5;
public function FollowPlayer(clip1:MovieClip, clip2:MovieClip): void
// clip1 is the enemy, clip2 the player being followed.
_clip1 = clip1;
_clip2 = clip2;
_clip1.stage.addEventListener(Event.ENTER_FRAME, followPlayer);
_clip2.stage.addEventListener(Event.ENTER_FRAME, followPlayer);
private function followPlayer(_clip1:MovieClip, _clip2:MovieClip)
if (_clip1.y > _clip2.y)
_clip1.y -= speed;
if (_clip1.y < _clip2.y)
_clip1.y += speed;
if (_clip1.x > _clip2.x)
_clip1.x -= speed;
if (_clip1.x > _clip2.x)
_clip1.x -= speed;
Thanks guys! My code was seriously flawed, but I ended up getting it to work. For anyone else that might be interested, see 'FollowPlayer' below, an extremely simple class which takes two MovieClips as arguments, and moves the first one slowly (at 24fps) toward the second one:
package jab.enemy
import flash.display.MovieClip;
import flash.events.Event;
public class FollowPlayer
private var _clip1:MovieClip
private var _clip2:MovieClip
private var speed = 1 + Math.random();
public function FollowPlayer(clip1:MovieClip, clip2:MovieClip): void
// clip1 is the enemy, clip2 the player being followed.
_clip1 = clip1;
_clip2 = clip2;
_clip1.stage.addEventListener(Event.ENTER_FRAME, onEnterFrame)
function onEnterFrame(event:Event):void
if (_clip1.y > _clip2.y)
_clip1.y -= speed;
if (_clip1.y < _clip2.y)
_clip1.y += speed;
if (_clip1.x > _clip2.x)
_clip1.x -= speed;
if (_clip1.x < _clip2.x)
_clip1.x += speed;
Similar Messages
-
What is the class for creating the excel sheet in the java
please say the class for creating the excel sheet in java (servlets,jsp)
You can also cheat and rename a html file to xls.
Just use standard html tables. Should be able to use google to find a working example. -
Class for creating the container in web dympro like include INCLUDE OBJECT
Hi how can we use the macros swc_container. swc_set*** .. etc in webdynpro . ??
I have to pass some vaules to the event container .
As we cant user includes in webdynpro is there a class to carry out the same task .
i.e;Class for creating the container in web dympro like include INCLUDE <OBJECT> or INCLUDE <cntn01>.
Thanks ,
naval BhattHi,
You had the same question in worfklow forum. I suggest you to include your non-OO-compliant code to for example a function module. OR even better, you might want to take a look to function modules SAP_WAPI*. There are plenty of standard functions, which you can use to do the same things as the macros you are now trying to use. For example raising workflow events, etc.
Regards,
Karri -
User Exit for making the field Bill of Lading Mandatory in Delivery
Please suggest an User Exit for making the field Bill of Lading Mandatory in the Delivery document when we create an inbound delivery.
Hi,
I'm not sure, pls check these
USEREXIT_SAVE_DOCUMENT_PREPARE
EXIT_SAPLV46H_001
NOTIF_EVENT_SAVE
thanks
Mohanprabu C -
Steps for making the changes in DC and checking into NWDI
Hi Experts,
I am new to the NWDI
I have some questions related to the NWDI and NWDI integration manggement.
We have some set of SC's got from some team. Now we need to upload to our NWDI .For that I have done the following steps.
I have created some track in the CMS.
I have loded that SC in to the track.
I have imported that track in to the NWDS.
The track which imported contains the SC , this SC contains some DC's .
for getting the project in to the local mechine.
In the DC prospective -> Inactive DCs -> done the right click on the respective DC's and choosen as Create project option. Then i am able to see the DC project in the webdynpro prospective.
Now the project in the local mechine see the code and i need to rebuild and deploy .
What are steps need to be done. Please provide the step by step information for doing this
Thanks& Regards
vijayHi Vijay,
Follow this:
1.Import a development configuration.
The first step for you as a developer is to import an appropriate development configuration. The development configuration is your connection to the NWDI. By importing a development configuration, you get access to all resources relevant for your work without having to search for the right sources, libraries and servers.
2.Select the components you want to develop.
In the Development Configurations perspective, you can create projects for existing components to add them to your development list, The development environment automatically loads the required source files and archives into your local file system and tries to build the selected components locally
3. Create new components.
You can use the Development Configurations perspective also to create new components .Create the new component directly in the DTR. The development environment may propose a change list ("activity") or prompt you to create a new activity to be used to record the creation of the component.
4.Synchronize the source files and libraries.
From time to time, you should resynchronize your local sources and libraries with the NWDI to receive the most up-to-date changes of other developers.
5.Change the component sources.
Before you can change a source file, you must make the intended change known to the DTR (to check out the file) and agree on an activity to record the change. You can create a new activity or use an existing one.
6.Edit components.
Depending on the type of the component you develop, you can perform components development using the Java, J2EE, WebDynpro, Dictionary or any other suitable perspective.
7. Release the changes for the central build.
After checking the changes in, you can pass them to the Component Build Service (CBS), that is, you perform the activation process.
8.Release the changes in the development landscape.
After a successful activation, pass your changes to the Change Management Service (CMS) of the NWDI, which transports your changes within the development landscape, for example, between a development system and a consolidation system.
Thanks
Krishna -
Writing own TableCellRenderer for setting the Background Color of a cell ?
Hello,
I am using the JTable and DefaultTableModel for my GUI. I use also only plain text in the rows and columns. I have a method which examine every row wether something is wrong with a string so if something is wrong i want to set the BackgroundColor of this cell with the bad string to a color i can define.
Do I need to write an own TableCellRenderer for this tiny task?
Table class has no setBackground(new Color(22,22,22),posRow,posCol);http://forum.java.sun.com/thread.jspa?forumID=57&threa
dID=606504this code is from your ColorRenderer class:
public void actionPerformed(ActionEvent e)
Iterator it = colors.keySet().iterator();
while ( it.hasNext() )
Point key = (Point)it.next();
int row = key.x;
int column = key.y;
if (column == -1)
model.fireTableRowsUpdated(row, row);
else if (row == -1)
int rows = table.getRowCount();
for (int i = 0; i < rows; i++)
model.fireTableCellUpdated(i, column);
}you have set an ActionListener to the ColorRenderer class and put the actionPerformed method in it but compared to a JButton the actionPerformed method is called when i click the JButton but what you do in your code that the actionPerformed method is executed. I have deleted the whole actionPerformed method and the listener and still the cell is displayed with a color so was it for the blinking?
And the method setBackground is nowhere called or run actively so is this method called internally by the ColorRenderer class? or is this method somehow called recursively as in the method setBackground I can see this method call:
c.setBackground( (Color)o ); but i think this is another setBackground method right? because the first method i mentioned has 3 parameters not 1 parameter so where is the method setBackground with 3 parameters called actively in your code? i cant find anything. ok after examining again the c.setBackground( (Color)o ); is the one with 3 parameters ;-)
public void setBackground(Component c, int row, int column)
{ that was set for the previous cell, so reset it here
if (c instanceof DefaultTableCellRenderer)
c.setBackground( table.getBackground() );
// In case columns have been reordered, convert the column number
column = table.convertColumnIndexToModel(column);
// Get cell color
Object key = getKey(row, column);
Object o = colors.get( key );
if (o != null)
c.setBackground( (Color)o );
return;
// Get row color
key = getKey(row, -1);
o = colors.get( key );
if (o != null)
c.setBackground( (Color)o );
return;
// Get column color
key = getKey(-1, column);
o = colors.get( key );
if (o != null)
c.setBackground( (Color)o );
return;
}using your full code gives me a bug:
when i double click in the first column to change some text doesnt matter which row then the selected cell gets a red border and the rest of the table freezes. When i exchange the order of the columns move column 1 to 2 and column 2 to 1 then the freezed table is working again?? could you help solving that problem else the cell color setting works fine for me :-) thank you very much! -
Best practices for making the end result web help printable
Hi all, using TCS3 Win 7 64 bit. All patched and up to date.
I was wondering what the best practices are for the following scenario:
I am authoring in Frame, link by reference into RH.
I use Frame to generate PDFs and RH to generate webhelp.
I have tons of conditional text which ultimately produce four separate versions of PDFs as well as online help - I handle these codes in FM and pull them into RH.
I use a css on all pages of my RH to make it 'look' right.
We now need to add the ability for end users to print the webhelp - outside of just CTRL+P because a)that cuts off the larger images and b)it doesn't show header, footer, logo, date, etc. (stuff that is in the master pages in FM).
My thought is doing the following:
Adding four sentences (one for each condition) in the FM book on the first page. Each one would be coded for audience A, B, C, or D (each of which require separate PDFs) as well as coded with ONLINE so that they don't show up in my printed PDFs that I generate out of Frame. Once the PDFs are generated, I would add a hyperlink in RH (manually) to each sentence and link the associated PDF (this seems to add the PDF file to the baggage files in RH). Then when I generate my RH webhelp, it would show the link, with the PDF, correctly based on the condition of the user looking at the help.
My questions are as follows:
1- This seems more complicated than it needs to be. Is it?
2- I would have to manually update every single hyperlink each time I update my FM book, because I am single sourcing out of Frame and I am unable (as far as I can tell) to link a PDF within the frame doc. I update the entire book (over 1500 pages) once every 6 weeks so while this wouldn't be a common occurrence it will happen regularly, and it would be manual (as far as I can tell)?
3- Eventually, I would have countless PDFs inside RH. I assume this will eventually impact performance. So this also doesn't seem ideal?
If anyone has thoughts/suggestions on a simpler way or better way to do this, I'd certainly appreciate it. I have watched the Adobe TV tutorial on adding a master page but that seems to remove the ability to use a css across all my topics and it also requires the manual addition of a manual hyperlink to the PDF file, so that is what I am proposing above, anyway (not sure the benefit, therefore).
Thanks in advance,
AdrianaAnything other than CTRL + P is going to create a lot of work so perhaps I can comment on what you see as drawbacks to that.
a)that cuts off the larger images and b)it doesn't show header, footer,
logo, date, etc. (stuff that is in the master pages in FM).
Larger images.
I simply make a point of keeping my image sizes down to a size that works. It's not a problem for me but that doesn't mean it will work for you. Here all I am doing is suggesting you review how big a problem that would be.
Master Page Details
I have to preface this with the statement that I don't work with FM. The details you refer to print when they are in RoboHelp master pages. Perhaps one of the FM users here can comment on how to get FM master pages to come through.
See www.grainge.org for RoboHelp and Authoring tips
@petergrainge -
Req as follows :
1. i need to create one method in a assistance calss for updating custom table .
2. now i have to pass the multiple entries to that table then inside the method based need to update the Ztable. based on this entries
3. My internal table is having 2 fields ( Customernumber (key field) , Shiftloc ).(Multiple entries ex : 500)
based on customernumber need to update the new shiftloc in my custom table.
Can any one give some inputs please. i have doubt can we pass mupltiple entries (internal) as a importing parameter to the method?
Cheers,
VenuHi rama,
thank you for your promt reply.
i have one more query. Here i need to update the only Shipt to adress for particular customer number.
i have written the code as below. Please clarify this code will work for my requirement.
method UPDATE_SHIPTO.
data : Lt_contract type ty_update_shipto_t.
data : ls_contract like line of Lt_contract .
REFRESH : Lt_contract.
lt_contract[] = LT_DATA[].
loop at lt_contract into ls_contract.
* update Zcustom SET ship_to_adress = ls_contract-new_bp
WHERE cust_no = ls_contract-custnum
CLEAR : ls_contract.
ENDLOOP.
COMMIT WORK.
endmethod. -
Please help!
This depends on whether you need to open previously created AppleWorks documents. The only programs which can do this are EazyDraw (right) and Intaglio (though when I tested the demo it wouldn't open complex drawings such as the one below). If you are dealing with complex technical drawings EazyDraw is probably the best choice: it's about the same cost as the whole of iWork (when downloaded, and rather more expensive on a CD), but cheaper than some other vector based programs, and seems to handle the whole process well - though it does operate somewhat differently from AppleWorks. There is a much cheaper version available on the Mac App Store, but note that it does not open AppleWorks Draw Documents: neither does the latest version from their website (4.1.x) - for this you need 4.0.x 'Retro', also available from the website.
If you are only concerned with making new documents, then you can do a certain amount in Pages: but a better bet might be Swift Publisher 2, which is a layout program with a library of clip-art. I use it in preference to Pages for layout, though not for word processing - it isn't really designed for that.
EasyDraw is also a powerful drawing program: if you're not concerned with opening old AppleWorks documents the version from the Mac App Store is the one to go for. -
SQL query for making the horizontally stored data to vertical format
HI i have a table named table1 and columns and data as below like below
table1
Main sub1 sub2 sub3 sub4 sub5 sub6
A L1 T1
B L1 T1
C L2 T2 K1 T1
D L2 T2 K1 T1
Basically the data is stored in horizontal above.i want a query to make the data in vertical like below
A T1
A L1
B T1
B L1
C T1
C K1
C T2
C L2
D T1
D K1
D T2
D L2
Aslo even if the values come in sub5 and sub6 the query should handle and populate the values vertically and also if a new row added also.
Thanks a lot in advanceHi,
As usual, Hoek is absolutely correct.
There are a gazillion examples out there, but someone (I) will give you a specific answer.
Search for "pivot" or "rows to columns" and you will indeed get a gazillion hits. Unfortunately, all but a hemi-semi-demi-gazillion of them will say "There are already lots of examples out there: do a search". Perhaps [this one|http://forums.oracle.com/forums/message.jspa?messageID=3227388#3227388] can get you started.
The essential form of a pivot is:
SELECT r_val
, MIN (CASE WHEN c_val = 1 THEN d END) AS col_1
, MIN (CASE WHEN c_val = 2 THEN d END) AS col_2
, MIN (CASE WHEN c_val = n THEN d END) AS col_n
FROM table_x
GROUP BY r_val;Instead of MIN (which is probably what want) any aggregate function can be used.
This assumes you have a column r_val that indicates what row of output will contain each value. In your example, that's your first column,
It also assumes you have a column c_val that indicates what column will contain each value. In your example, what is that? Looking at the raw data, how can you tell that 'L2' will wind up in the 2nd column of 'D L2 T2 K1 T1', and not the 3rd, 4th or 5th? You may need to assign a c_val to each row (using the aggregate ROW_NUMBER function, perhaps). -
Book Suggestion for Making the Most of Soundtrack Pro
I have worked with Soundtrack Pro quite a bit but never seem to be able to get the results that I want. I was wondering if anyone had a suggestion for a book or books that would help me make the most of this program? I have problems with removing background noise sometimes I mess around and can get decent results but I feel there are common techniques I could use that I just don't know about. Are there any books that would just give me an overview of ways to make audio sound better? Then I can apply it to SP. I know this is not a tech SP question but I figured someone might have a suggestion
I want to preface this remark by saying that I'm a college prof. who teaches this stuff. I DEMAND that my students join LYNDA.COM for their excellent tutorials on seemingly anything and everything. The SOUNDTRACK PRO series is taught by Larry Jordan, an excellent teacher, and a "Sound" enthusiast. The tariff is only 25 bucks a month, and in two months, you'll be on your way. The best texts go for around 80 bucks, so cancel in two months and you're golden. I also recommend bookmarking parts of the Apple User Manual that are "off the main usage stream." example: Noise Reduction, Page 225, is a common destination for my students.
-
It seems that a couple of phrases on the Afrikaans Firefox are direct translations from English and is not quite correct.
However, again a BIG thank you for having gone through the effort to have the language available.Maybe file a bug report about that issue.
*https://bugzilla.mozilla.org/describecomponents.cgi?product=Mozilla%20Localizations -
About:config setting for making the menubar visible
Hi, I've been trying to customize firefox for deployment. I need to be able to enable the menubar by default on firefox. I know how make the menubar visible via the orange firefox button but that's not a feasible option on a group of computers. I've looked through about:config, searched and googled, but I can't seem to find a setting that will make the menubar visible by default. Any help would be appreciated.
This needs chrome code not a config change.
See ''How do I get rid of both the orange icon with firefox and the menu bar?'' [/questions/946916]
You could also consider the possibility of using [http://www.mozilla.org/en-US/firefox/organizations/ ESR] as a method of reducing maintenance, and maybe use of a .cfg file to lock the installations http://kb.mozillazine.org/Locking_preferences -
How to use inbound exit class for more than one workflow step
Hi All,
In Offline Workflow Approval Scenarios where the work items are sent to outlook of non sap users inbox through workitem exit of the respective workflow item. Based on the user reply from outlook email(either approve or reject) which sends an auto reply to Offline user . We configure an inbound exit class and assign the same in the SMICM transaction. Based on the code written using SAP_WAPI function modules in inbound class exit offline user gets the user approval result and performs the action in SAP.
My question now Is how can we use this inbound exit class for all the steps of a workflow.
For ex: In a workflow I have a decision step followed by an activity step. First I will write the work item exit for the user decision step and inbound exit code for the user decision step and offline user executed the user decision step with approve action.
followed by that I have an activity step for that I will code a work item exit for that activity level but how can I user the same inbound exit class for the activity step as well .
Quick reply would be of great help for me.
With Best Regards,
VeniFor the outbound processing you have the option of replacing the workflow exit by chancing the bsp application of the extended notification (see note 1448241 solution as an example of how to do the change) and replacing the standard links with a "mailto:...".
As far as the inbound processing, that depends on what should be done in the activity step, if for example you have a bapi which executes what the user does you can call it in the inbound class instead of the user and then the relevant wapi (complete the workitem/raise event etc.). -
Exit Class for Inbound Mail not getting triggered
Hi Gurus,
I have created an exit class for processing the Inbound Mail that comes to SAP Inbox (SOIN).
I have set up the Inbound processing rule in transaction SO50 and set it to all recipients.
If i send a mail from any external id to the id configured in SAP then it is coming in SAP Inbox (SOIN) but the exit class for processing the email is not getting triggered.
I have made all the settings for SMTP.
Kindly guide me with the steps needed to be followed for triggering the Exit Class.Hi
Check u have maintained ur outgoing mail server IP in SCOT transation.
Check link step to configure PO mail.
http://architectsap.com/blog/sap/sap-mm-purchasing-send-purchase-order-by-mail-to-vendor-in-sap/
Maybe you are looking for
-
Network Printer Setup in Solaris 10
What is the best way to set up HP JetDirect network printers in Solaris 10? I have just installed Solaris 10 on an Ultra Sparc 10. There are two HP Laserjet Printers (HP LJ 4100DTN and HP LJ 4000TN) with JetDirect cards on my network. I want to be ab
-
Displaying header in excel horizontally using FM GUI_DOWNLOAD
Dear Experts, I'm exporting my data to an excel file using GUI_DOWNLOAD. The problem is that I'm having problems with exporting the headings of my excel. I can export the heading but the problem is that it is displayed vertically and not ho
-
Hi. Does anyone know what video editing software is compatible with my MacBook - version 10.6.3? I am looking to edit films and already have Final Cut Pro, but am looking for something a little more basic and easier to use. Thanks. Vicki
-
Organizational objects do not create a Business Partner ID
I am setting up SRM org structure with PPOCA_BBP/PPOMA_BBP transaction. I am creating, companies, plants, purchase orgs, purchasing groups and positions and the problem is that SRM is not assigning a Business Partner number to any of those. I have al
-
How do you un disabled an ipod?
my ipod is locked and will not unlock and i dont know how to unlock it?!