How to add parametes in the action calss
hello friends
Iwant to add parametes in the action cladd
<action
path="/QuickSearch"
type="app.struts.QuickSearchAction"
name="quickSearchForm"
scope="request"
input="quickSearch.jsp"
validate="true">
<forward name="success" path="/jsp/appController.jsp"/>
I need url like that "appController.jsp?name=namevalue&old=oldvalue"
public class QuickSearchAction extends Action
public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception
return mapping.findForward("success");
}thanks
</action>
I try with
public class QuickSearchAction extends Action
public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception
ActionForward Myorward = mapping.findForward("success")
Myorward.setPath("/jsp/appController.jsp?name=namevalue&old=oldvalue");
return Myforward;
}but it work not !!!!!!! please help me
thanks
Similar Messages
-
How to add parameter to the test file
While we do the 3rd party test, can we add arguments or parameters to the "Test File" which will be loaded by Browse? Since we may have a lot of similar tests, just need to give different parameter for doing similar but different work. Is this possible?
Thanks,
Jasonheyy i could find the solution to it....so am closing the thread..thanksss
-
How to add request in the buffer
Hii All,
How to add request in the buffer in bulk.
i am using following command.
tp addtobuffer requestno <sid>
but after doing it is giving me the following error
C:\usr\sap\trans\bin>tp addtobuffer BWDK900161 BT1
^CThis is tp version 340.07 (release 640, unicode enabled)
E-TPSETTINGS could not be opened.
EXIT
ERROR: System : Parameter SAPEVTPATH not set. Batch jobs cannot be started.
Error in TPSETTINGS: transdir not set.
tp returncode summary:
TOOLS: Highest return code of single steps was: 0
ERRORS: Highest tp internal error was: 0208
tp finished with return code: 208
meaning:
error in transportprofil (param missing, unknown,...)
Pls help.
Regards,
Viren.Hi Rolf,
thax for your reply.
But still it is not working it shows following message.
C:\usr\sap\trans\bin>tp addtobuffer BWDK900051 BT1 pf=c\usr\sap\trans\bin\TP_DOM
AIN_BT1.PFL
This is tp version 340.07 (release 640, unicode enabled)
E-c\usr\sap\trans\bin\TP_DOMAIN_BT1.PFL could not be opened.
EXIT
ERROR: System : Parameter SAPEVTPATH not set. Batch jobs cannot be started.
Error in c\usr\sap\trans\bin\TP_DOMAIN_BT1.PFL: transdir not set.
tp returncode summary:
TOOLS: Highest return code of single steps was: 0
ERRORS: Highest tp internal error was: 0208
tp finished with return code: 208
meaning:
error in transportprofil (param missing, unknown,...)
Regards,
Viren. -
Reg:How to add fields to the scripts in detail
How to add fields to the scripts in detail.
Plz give me one example help me out.Hi
add fields to the scripts by sending that field between two &s.
for example if u want to add lifnr of lfa1 table then pass field like this.
&wa_lfa1-lifnr&.here wa_lfa1 is work area for internal table it_lfa1.
if name1 then &wa_lfa1-name1&
in this way you can add fields to the script under any window.
i am sending one example program for scripts.
&--structure declaration--
TYPES:BEGIN OF ST_LFA1,
LIFNR TYPE LFA1-LIFNR,
NAME1 TYPE LFA1-NAME1,
LAND1 TYPE LFA1-LAND1,
ORT01 TYPE ORT01,
REGIO TYPE REGIO,
END OF ST_LFA1.
TYPES:BEGIN OF ST_EKKO,
EBELN TYPE EKKO-EBELN,
BUKRS TYPE EKKO-BUKRS,
AEDAT TYPE EKKO-AEDAT,
ERNAM TYPE EKKO-ERNAM,
BSTYP TYPE EKKO-BSTYP,
LIFNR TYPE EKKO-LIFNR,
END OF ST_EKKO.
TYPES:BEGIN OF ST_EKPO,
EBELN TYPE EKPO-EBELN,
EBELP TYPE EKPO-EBELP,
LOEKZ TYPE EKPO-LOEKZ,
AEDAT TYPE EKPO-AEDAT,
MATNR TYPE EKPO-MATNR,
NETWR TYPE EKPO-NETWR,
END OF ST_EKPO.
&--internal table,work area declaration--
DATA:WA_LFA1 TYPE ST_LFA1,
IT_LFA1 TYPE STANDARD TABLE OF ST_LFA1,
WA_EKKO TYPE ST_EKKO,
IT_EKKO TYPE STANDARD TABLE OF ST_EKKO,
WA_EKPO TYPE ST_EKPO,
IT_EKPO TYPE STANDARD TABLE OF ST_EKPO.
&--data declaration--
DATA:TOTAL TYPE EKPO-NETWR,
V_EBELN TYPE EKKO-EBELN.
data: v_item(20) type c.
&--parameter for purchase document number--
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
PARAMETERS P_PURDOC LIKE V_EBELN.
SELECTION-SCREEN END OF BLOCK B1.
START-OF-SELECTION.
PERFORM GET_DATA_FROM_EKKO.
PERFORM GET_DATA_FROM_LFA1.
PERFORM GET_DATA_FROM_EKPO.
&--grand total--
LOOP AT IT_EKPO INTO WA_EKPO.
TOTAL = TOTAL + WA_EKPO-NETWR.
CLEAR WA_EKPO.
ENDLOOP.
&--open form--
CALL FUNCTION 'OPEN_FORM'
EXPORTING
DEVICE = 'PRINTER'
FORM = 'Z_50886_VENDOR'
LANGUAGE = SY-LANGU
EXCEPTIONS
CANCELED = 1
DEVICE = 2
FORM = 3
OPTIONS = 4
UNCLOSED = 5
MAIL_OPTIONS = 6
ARCHIVE_ERROR = 7
INVALID_FAX_NUMBER = 8
MORE_PARAMS_NEEDED_IN_BATCH = 9
SPOOL_ERROR = 10
CODEPAGE = 11
OTHERS = 12
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
&--write form for header details--
READ TABLE IT_EKKO INTO WA_EKKO INDEX 1.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'HEAD'
WINDOW = 'HEADER'
EXCEPTIONS
ELEMENT = 1
FUNCTION = 2
TYPE = 3
UNOPENED = 4
UNSTARTED = 5
WINDOW = 6
BAD_PAGEFORMAT_FOR_PRINT = 7
SPOOL_ERROR = 8
CODEPAGE = 9
OTHERS = 10
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
&--write form for item details--
LOOP AT IT_EKPO INTO WA_EKPO.
concatenate wa_ekko-ebeln wa_ekpo-ebelp into v_item.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'ITEM'
WINDOW = 'MAIN'
EXCEPTIONS
ELEMENT = 1
FUNCTION = 2
TYPE = 3
UNOPENED = 4
UNSTARTED = 5
WINDOW = 6
BAD_PAGEFORMAT_FOR_PRINT = 7
SPOOL_ERROR = 8
CODEPAGE = 9
OTHERS = 10
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDLOOP.
&--write form for vendor details--
READ TABLE IT_LFA1 INTO WA_LFA1 INDEX 1.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'VENDOR'
WINDOW = 'ADDRESS'
EXCEPTIONS
ELEMENT = 1
FUNCTION = 2
TYPE = 3
UNOPENED = 4
UNSTARTED = 5
WINDOW = 6
BAD_PAGEFORMAT_FOR_PRINT = 7
SPOOL_ERROR = 8
CODEPAGE = 9
OTHERS = 10.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
&--write form for grand total--
CALL FUNCTION 'WRITE_FORM'
EXPORTING
WINDOW = 'TOTAL'
EXCEPTIONS
ELEMENT = 1
FUNCTION = 2
TYPE = 3
UNOPENED = 4
UNSTARTED = 5
WINDOW = 6
BAD_PAGEFORMAT_FOR_PRINT = 7
SPOOL_ERROR = 8
CODEPAGE = 9
OTHERS = 10
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
&--close form--
CALL FUNCTION 'CLOSE_FORM'
EXCEPTIONS
UNOPENED = 1
BAD_PAGEFORMAT_FOR_PRINT = 2
SEND_ERROR = 3
SPOOL_ERROR = 4
CODEPAGE = 5
OTHERS = 6
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*& Form get_data_from_ekko
FORM GET_DATA_FROM_EKKO .
SELECT EBELN
BUKRS
AEDAT
ERNAM
BSTYP
LIFNR
FROM EKKO INTO TABLE IT_EKKO WHERE EBELN = P_PURDOC.
ENDFORM. " get_data_from_ekko
*& Form get_data_from_lfa1
FORM GET_DATA_FROM_LFA1 .
IF NOT IT_EKKO[] IS INITIAL.
SELECT LIFNR
NAME1
LAND1
ORT01
REGIO
FROM LFA1 INTO TABLE IT_LFA1 FOR ALL ENTRIES IN IT_EKKO WHERE
LIFNR = IT_EKKO-LIFNR.
ENDIF.
ENDFORM. " get_data_from_lfa1
*& Form get_data_from_ekpo
FORM GET_DATA_FROM_EKPO .
IF NOT IT_EKKO[] IS INITIAL.
SELECT EBELN
EBELP
LOEKZ
AEDAT
MATNR
NETWR
FROM EKPO INTO TABLE IT_EKPO
WHERE EBELN = P_PURDOC.
ENDIF.
ENDFORM. " get_data_from_ekpo -
How to add spaces at the end of record
Hi Friends,
i am creating a file which contains more than 100 records.
In ABAP i have internal table with on field(135) type c.
some time record have length 120, somtime 130 its vary on each record.
but i would like to add space at the end of each record till 135 length.
Can you please help me how to add speace at the end of record.
regards
MalikSo why did you said that in your first posting? My glass sphere is out for cleaning...
Instead of type c use strings and add spaces until they have the appropriate length.
loop at outtab assigning <pout>.
while strlen( <pout>-val ) < 135.
concatenate <pout>-val `` into <pout>-val.
endwhile.
endloop. -
How to pass parameter to the Query String of the Named Queries'SQL
Firstly to say sorry,I'm a beginner and my English is very little.
Now I want to know
How to pass parameter to the Query String of the Named Queries'SQL in the Map editor.
Thanks.benzi,
Not sure if this is on target for your question, but see #5 in the link below for some web screencasts that show how to pass an input text form field value to the bind variable of a view object. If you're looking for something different, maybe provide some more details such as what you are trying to accomplish and what technology stack you are using - for example, ADF BC, JSF, etc.
http://radio.weblogs.com/0118231/stories/2005/06/24/jdeveloperAdfScreencasts.html
Also see section 5.9 and chapter 18 in the developer's guide.
thanks -
How to add marker on the clip?
Hi!!!
Could you help me, how to add marker on the clip? Not on the sequence. I need the marker to moving as I moving clip in the sequence.
Thanks!!!Ohhh... I just had to switch to the source monitor. OK. Just I don't use the source monitor usally. Only the program one. Thank you. It worked!
Fri, 12 Oct 2012 05:02:08 -0600 от Jim Simon <[email protected]>:
>
>
Re: How to add marker on the clip?
created by Jim Simon in Premiere Pro CS5, CS5.5, & CS6 - View the full discussion -
How to add filter in the dist. model
hi,
how to add filter in the dist. model
thanks
RubanHi,
Please try this.
1. Go to transaction BD64.
2. Click on Change button.
3. Expand the corresponding model view.
4. Expand the corresponding message type (i.e MATMAS).
5. Place the cursor to 'No filter set' and double click.
6. Click on Create Filter Group.
7. Add your filter from here ...
8. Once done, save the model view.
For more information, please check this link.
http://help.sap.com//saphelp_470/helpdata/EN/0b/2a611c507d11d18ee90000e8366fc2/frameset.htm
Regards,
Ferry Lianto -
How to add Acrobat to the Microsoft Office ribbon?
how to add Acrobat to the Microsoft Office ribbon?
Hi ebender888,
What versions of Acrobat and Office do you have? See if this post helps: https://answers.acrobatusers.com/Why-Acrobat-PDFmaker-Office-COM-Addin-tab-disappearnig-Wo rd-Office-2013-q152959.aspx
If not, let us know what software you're using, and we'll try to get you pointed in the right direction.
Best,
Sara -
HT5654 how to add videos to the ipad using the latest version of itunes
how to add videos to the ipad using the latest version of itunes ?
Hello zaraa90,
After reviewing your post, I have located an article that can help with syncing content. It contains a number of troubleshooting steps and helpful advice for the issue you are experiencing:
Sync your iPhone, iPad and iPod with iTunes using USB
Thank you for contributing to Apple Support Communities.
Cheers,
BobbyD -
How to add Video on the OAF page like youtube ?
Any one know how to add Video on the page?
If you are getting HTML code from one of these slideshow.com places, you can add this code to your iWeb pages with a little bit of work. Two things to keep in mind...1. No way to do this via iWeb directly, so it involves editing the published html files, and 2. Because iWeb republishes the html files whenever you update the your webpage, you will lose your changes and have to redo them to add your slideshows back.
The general directions are as follows...
1. Decide where you want your slideshow and know exactly what dimensions you need.
2. Insert a text box onto your page and adjust its size to exactly your dimensions.
3. Type in some uniquely identifiable text like, "SLIDESHOWHERE" without changing the font or anything else...just type it in.
4. Publish your page with iWeb.
5. Find the html file associated with your published page (either on your iDisk or in a folder depending on how you published) and open it in any text editor (like Microsoft Word, or Textedit, or anything). You may need to set your text editor to "ignore rich text" or to "show HTML source".
6. Scroll through the html file and locate your placeholder text, e.g. "SLIDESHOWHERE".
7. Replace the placeholder text with your html code and save your page.
That's it. You should see your slideshow element show up in Safari where you placed the text box in iWeb! -
How to add reminders on the new ios6? I don't have the plus (+) on the upper right as seen on ios5 to add reminder.
Also, tap the lines at the top left and create a new list, that should give you the + back.
-
How to add subpartitions to the existing subpartition template
Hi All,
My Question is ,how to add Subpartition to the exiting subpartition template. e
like i have created a table with subpartition template with with 5 subpartitions like
subpartiton one_1 value (121)
subpartition two_2 value(122)
and now i one to add one more subpartitin to the existing subpartition template(Like modify the existing subpartition templete).
subpartition three_3 value(123)
Could any suggest me.
Thanks
Sree>
My Question is ,how to add Subpartition to the exiting subpartition template.
>
Follow the example in the section for 'Modifying a Subpartition Template' in the VLDB and Partitioning Guide
http://docs.oracle.com/cd/E11882_01/server.112/e25523/part_admin002.htm#i1007904
>
You can modify a subpartition template of a composite partitioned table by replacing it with a new subpartition template. Any subsequent operations that use the subpartition template (such as ADD PARTITION or MERGE PARTITIONS) now use the new subpartition template. Existing subpartitions remain unchanged.
If you modify a subpartition template of an interval-* composite partitioned table, then interval partitions that have not yet been created use the new subpartition template.
Use the ALTER TABLE ... SET SUBPARTITION TEMPLATE statement to specify a new subpartition template. For example:
ALTER TABLE emp_sub_template
SET SUBPARTITION TEMPLATE
(SUBPARTITION e TABLESPACE ts1,
SUBPARTITION f TABLESPACE ts2,
SUBPARTITION g TABLESPACE ts3,
SUBPARTITION h TABLESPACE ts4 -
How to Add parameter fields in BI publisher fields
Hi,
I'm creating xml report for Apps standard Trial Balance Summary, here i cant able to run the .rdf locally due to SRW.UserExit .
So i got the XML file from output of the report.
Then i added the xml data in BI publisher and then i have created the .rtf for that.
Here i need to add some fields which is not available in fields list (in BI Publisher).
How to add that fields, or is possible to add fields manually.
That fields are given as parameters while running the .rdf file.
Please tell me how to solve this problem.
Is possible to add fields manually means tell me how to do that.If those fields are input parameters to the concurrent program then you can display them in RTF by declaring and printing it as
<?param@begin:P_CONC_PARAM?>
and display it as <?$P_CONC_PARAM?> - Note P_CONC_PARAM should match your parameter token -
How to add new increase the pool rather then trowing a error.
Im trying to build a game and after many attempts and hours of thinking i did manage to create something that looks like a game.The problem now is that there are so many objects that are constantly creating and removing from the stage. that the game is starting to slow down(it is laggy.).So i have searched the net and understood that i will have to use a "Object pooling Method" rather than creating and removing the objects after i dont have any use of them any more, if i want to make the game more memory friendly.
At first i didnt want to use this method (object pooling) ,but after a while i understood that i dont have a lot of options.So i started to search how and why and how.
Yet in this example im just trying this for the bullets (for now) cause if i can do it for them, i can manage to do it for other objects and projects (it will be simple for me to understand what is happening ., what am i doing , when do i add an existing object from the pool and when im creating a new one(when there are non left, things like this)
i did copy some part of this code from a tutorial that i found in the net but , from then i dont know how to increase the pool rather than throwing this error. I did try to create a new object or to increase the pool length but .... it is not working so im sure that im not doing something the way it must be done.
so i have this so far :
its a "simple" pool that calls a simple shape class (circle dot) and gives that to the main stage when the "SPACE" button is pressed
package
import flash.display.Sprite;
import flash.events.Event;
import flash.display.Bitmap;
import flash.display.BitmapData;
import flash.display.Shape;
public class Bullet extends Sprite{
public var rectangle:Shape = new Shape();
public function Bullet(){
super();
addEventListener(Event.ADDED_TO_STAGE, init);
graphics.beginFill(0xFF0000);
graphics.drawRect(-5, -5, 10,10);
graphics.endFill();
private function init(event:Event):void{
the SpritePool where i cant figure out how to replace the throw new error with some new code that will increase the pool
package {
import flash.display.DisplayObject;
public class SpritePool {
private var pool:Array;
private var counter:int;
public function SpritePool(type:Class, len:int) {
pool = new Array();
counter = len;
var i:int = len;
while (--i > -1) {
pool[i] = new type();
public function getSprite():DisplayObject {
if (counter > 0) {
return pool[--counter];
} else {
throw new Error("You exhausted the pool!");
public function returnSprite(s:DisplayObject):void {
pool[counter++] = s;
and the Game class (the documents class)
package {
import flash.ui.Keyboard;
import flash.display.Sprite;
import flash.events.Event;
import flash.events.KeyboardEvent;
import flash.display.Bitmap;
import flash.display.BitmapData;
import flash.display.Shape;
public class Game extends Sprite {
private var ship:Shape;
private var bullets:Array;
private var pool:SpritePool;
public function Game() {
Assets.init();
addEventListener(Event.ADDED_TO_STAGE, init);
private function init(event:Event):void {
pool = new SpritePool(Bullet,10);
bullets = new Array();
ship = new Shape();
ship.graphics.beginFill(0xFF00FF);
ship.graphics.drawRect(0,0, 60, 60);
ship.graphics.endFill();
ship.x = stage.stageWidth / 2 - ship.width / 2;
ship.y = stage.stageHeight - ship.height;
addChild(ship);
stage.addEventListener(KeyboardEvent.KEY_DOWN, onDown);
addEventListener(Event.ENTER_FRAME, loop);
private function onDown(event:KeyboardEvent):void {
if (event.keyCode == Keyboard.SPACE) {
var b:Bullet = pool.getSprite() as Bullet;
b.x = ship.x + ship.width / 2;
b.y = ship.y;
addChild(b);
bullets.push(b);
trace("Bullet fired");
private function loop(event:Event):void {
for (var i:int=bullets.length-1; i>=0; i--) {
var b:Bullet = bullets[i];
b.y -= 10;
if (b.y < 0) {
bullets.splice(i, 1);
removeChild(b);
pool.returnSprite(b);
trace("Bullet disposed");
any suggestions/help how to do itTo put you on the path (the errors/events needs formalization), here would be a quick example. Your pool class:
package
import flash.display.DisplayObject;
public class SpritePool
private var pool:Array;
private var counter:int;
private var classRef:Class;
// public get to know what's left in the pool
public function get availableObjects():int
return counter;
public function SpritePool(type:Class, len:int)
classRef = type;
pool = new Array();
counter = len;
var i:int = len;
while (--i > -1)
pool[i] = new classRef();
public function getSprite():DisplayObject
if (counter > 0)
return pool[--counter];
else
throw new Error("PoolExhausted");
public function returnSprite(s:DisplayObject):void
pool[counter++] = s;
public function increasePool(amount:int):void
counter += amount;
while (--amount > -1)
pool.push(new classRef());
public function decreasePool(amount:int):void
if (counter >= amount)
counter -= amount;
pool.splice(counter - amount,amount);
else
throw new Error("PoolDecreaseFail");
Now you'd need to be catching those errors. Again, the errors should be formalized or you could use events by extending IEventDispatcher. I kept it simple.
Here would be the simple Bullet class I'm using:
package
import flash.display.Sprite;
public class Bullet extends Sprite
private var bullet:Sprite;
public function Bullet():void
var bullet:Sprite = new Sprite();
bullet.graphics.beginFill(0xFF0000,1);
bullet.graphics.drawCircle(-5,-5,10);
bullet.graphics.endFill();
addChild(bullet);
Just draws a red circle just to visualize it..
Here would be a full example of using it. It will import both of these classes (saved as SpritePool.as and Bullet.as in the same folder). Paste this in the actions panel on frame 1:
import SpritePool;
import Bullet; // a simple red 10px circle
import flash.display.Sprite;
import flash.utils.setTimeout;
// fill the pool, swim trunks optional
var pool:SpritePool = new SpritePool(Bullet, 10);
// grab some objects from the pool
// array of currently held objects
var myBullets:Array = new Array();
while (pool.availableObjects > 0)
myBullets.push(pool.getSprite());
// display in random positions
for (var i:int = 0; i < myBullets.length; i++)
addChild(myBullets[i]);
// position
myBullets[i].x = int(Math.random()*stage.stageWidth);
myBullets[i].y = int(Math.random()*stage.stageHeight);
trace("myBullets has " + myBullets.length + " bullets! pool has " + pool.availableObjects + " left.");
// now I want one more, but I should check for errors
try
// fail, none left!
myBullets.push(pool.getSprite());
catch (e:*)
// this should be a custom event, but for speed, quick and dirty
if (e == 'Error: PoolExhausted')
trace("D'oh no more bullets! I need more!");
pool.increasePool(10);
trace("Added 10 more, now available in pool " + pool.availableObjects);
// try to reduce the pool by 15, which should error
try
pool.decreasePool(15);
catch (e:*)
// again should be a formal error
if (e == 'Error: PoolDecreaseFail')
trace("Oops, can't reduce pool by 15! Let's trim all extras, available is " + pool.availableObjects);
// we know it'll work, no error checking
pool.decreasePool(pool.availableObjects);
trace("Left in pool: " + pool.availableObjects);
// now lets wait 5 seconds and remove it all back to the pool
setTimeout(ReturnToPool,5000);
function ReturnToPool():void
// now let's just return all the objects to the pool
while (myBullets.length > 0)
removeChild(myBullets[myBullets.length - 1]);
pool.returnSprite(myBullets.pop());
// now check the pool, should have 10
trace("Amount of bullets in use " + myBullets.length + ", in pool " + pool.availableObjects);
For ease you can just download my example source (saved down to CS5).
Anything from here is just symantics. For example instead of throwing an error because the pool is too small you could simply increase the pool by a fixed amount yourself and return the objects requested.
To keep objects as low as possible you could use a timer to measure the amount of objects in use over a duration and reduce the pool appropriately, knowing the pool will grow as it needs.
All of this is just to avoid unnecessary object creation.
BTW here's my trace which should match yours:
myBullets has 10 bullets! pool has 0 left.
D'oh no more bullets! I need more!
Added 10 more, now available in pool 10
Oops, can't reduce pool by 15! Let's trim all extras, available is 10
Left in pool: 0
(after 5 seconds)
Amount of bullets in use 0, in pool 10
Maybe you are looking for
-
Best Buy DOES need to address all the negative issues with Citibank!
Hi, I've read all the negative posts about Citibank. I have been a loyal customer of Best Buy for quite some time and have purchased products from washing machines to electric guitars. I have my own story: I've had nothing but issues with them since
-
Hi, I just want to be sure, I am new to JDeveloper and I would just like to verify/ask what correct version of JDeveloper should we use so we could deploy the finished applications on our Oracle Application Server 10g 10.1.2.0.2 without errors? Looki
-
HTML character encoding in Tooltip????
Hi, I am displaying text in a tooltip as HTML. The problem is that if I use funny characters such as the greater than and less than brackets, I get funny results. Is there an easy way - something like a URLEncoder which will convert all my chars into
-
Setting transaction isolation level for jDriver Oracle/XA
edocs (http://e-docs.bea.com/wls/docs70/oracle/trxjdbcx.html#1080746) states that, if using jDriver for Oracle/XA you can not set the transaction isolation level for a transaction and that 'Transactions use the transaction isolation level set on the
-
How do I copy pdf's to iBook on a Mac?
I am used to iBooks on an iPad but using Mavericks now and need to find out how to move PDFs from the cloud to my iBooks library on my laptop for use offline. Intro says I can save PDFs to iBooks but haven't succeeded. Don't want to do as others ha