Flash Game Problem Need Help! Action-Script 2.0

Im making a flash game its a sniper game btw and i am have a problem with after killing the target for it to go to the next frame. I have tried on(press) on(release) for buttons i hae tried lots of different stuff (1.3 hours of trying) and so i was wondering if you could help me out. and here the link to the download for the source .fla yes i uploaded it cuz i really need the help ! thanks for any help! http://fileape.com/?act=download&t=yz6Lhp0oDdAB-7whXWB62WIoACXMVgV7r1flbKy17aJZamyC-vXNFwx tZP6pwXV50NGk3XWK9anDa4m6tBfGEtPOZwKbuZFcaFyGyEGiYqeILdcvVuEZy3QVHX3xY6S170xapkdrZJN9lov4k hxeqJ4_S6aGRpNQWjTT3MhudPLa1ZBAi79CiPqX5kN835lD7vzAU0O6WJZaK6jZBROg2A,,
or
http://fileape.com/dl/2gI8YiSW9QGzIgAu
if the top one doesnt work (the top one shouldnt have a time wait)
Thanks for all help
also please if you can find the problem itd be nice to know what it is

I will not download the .fla - maybe if you hosted the .swf I would view it.
to change frame use: gotoAndStop(<framenumber>);
(without the < >, just a number for the fram).
I recommend you use movieclips for buttons and place all code on the main timeline. For movieclips, give them an identifier name (bottom left int he properties box of the movieclip) then on the main timeline use:
movieclipName.onRelease = function(){
gotoAndStop(10);//change 10 to the frame you wish to go to. gotoAndPlay(10) plays from the frame.

Similar Messages

  • Small Flash game, really need help please?

    I'm making a small Flash game, which is rotating rings in an image to create a coherent picture. Think of the puzzles in Assassins Creed.
    I have three scenes set up, one with the puzzle, one with a fade to white transition, and one with a congratulatory screen.
    I have this code to check if the orientation of the rings match, but I'm really new to actionscript so I'm not sure if it's right or not.
    function orientationCheck()
    if (center.orientation == 0 && ring1.orientation == 0 && ring2.orientation == 0 && ring3.orientation == 0 && ring4.orientation == 0)
    gotoAndPlay(1,"Scene2");
    else
    stop();
    Unfortunately it keeps playing through the movie and not giving the player time to solve the puzzle.
    I have CS5.5 if that makes any difference, please help, heck I can send you the file so you can see exactly what's going on, just let me know.

    the trace() function is, by far, the most important tool in flash for code debugging.  nothing else even comes close:
    function orientationCheck()
    trace(center.orientation,ring1.orientation,ring2.orientation,ring3.orientation,ring3.orien tation);
    if (center.orientation == 0 && ring1.orientation == 0 && ring2.orientation == 0 && ring3.orientation == 0 && ring4.orientation == 0)
    gotoAndPlay(1,"Scene2");
    else
    stop();
    Unfortunately it keeps playing through the movie and not giving the player time to solve the puzzle.
    I have CS5.5 if that makes any difference, please help, heck I can send you the file so you can see exactly what's going on, just let me know.

  • Unwanted pausing and freezing at the beginning - Flash player problem - Need help

    Hi everybody,
    I have got the following problem: the problem occurs especially on youtube.com.
    Every time when I open a video, the adobe flash player buffers the video a little bit and suddenly the grey line, which means the buffering on youtube video, stops. Then video plays only until the end of the grey buffer line. Then it freeze and I have to wait until 10-20 seconds until the grey line continues moving forward and at the same time the video continues to play.
    But I don't want to have that freezing problem at the beginning of each video.
    The important thing to know is: when I used a very old version of the flash player (the version 9 or 10) then every video on youtube worked very well without any freezing problems at the beginning
    What is the solution. Can you please help me?
    Here is what I have done so far:
    I updated my flash player to the latest version.
    My internet speed is very fast.
    When I click right on the youtube video screen in order to go to the settings: then I unchecked "active hardware acceleration, I changed the temporary storage limit to "unlimited".
    My global settings looks like the following: I checked "allow websites to save information on your computer" and "ask if a website wants to use a peer assisted network".
    My OS: Windows 7 (64)
    Current version of firefox, chrome and IE. I have the problem in every browser.
    In the attachment you can see 2 screenshots of my problem: One where you can see the grey buffer line. and the 2nd: where you can see that the video stopped loading and buffering and the video stopped playing.
    Unfortunately, I don't get money from the company for advertising its product *sigh*. ;-)

    Just because your internet connection is fast doesn't mean that the route from the specific server to you is also equivalently fast.  You can get some additional information by right-clicking the YouTube video and choosing Stats for nerds.  That information would be interesting.
    If video plays back fine once it actually buffers successfully, then there's probably not a lot you can do.  You might take a look at a different browser.  Google Chrome will probably use HTML5 playback on YouTube, and Internet Explorer will use the ActiveX control on Flash, which is significantly different from the NPAPI Flash Player used in Firefox.

  • Flash lite problem,,,need help soon

    why the protocol ftp is not suported by the flash player
    and how to make flash lite support ftp

    Actionscript 3 supports making ftp client aplications with flash because of binary sockets capability. There is no such facility in as2 (flash lite 2.0/2.1/3.0).
    You can use remoting to develop a ftp like application. also you can use http://wiki.kunerilite.net/index.php?title=Upload/Download_plugin for more help.

  • Please help me with a simple flash game problem

    I am trying to learn how to make flash games with Adobe flash 5.5. I am doing a tutorial from a book and am stuck.
    The game is called concentration and you are suppose to match 2 tiles of the same shape. there are 10 shape tiles
    and 1 question mark tile. These tiles are held in an array. 20 tiles are suppose to be displayed 5 to a row with 4 rows
    and the question mark is suppose to be up on all 20. My problem is I get a blank screen when I test the movie. I
    think the code is good but I beleive I have not uploaded the tiles right. I did upload the 11 tiles to the library and have
    those 11 tiles and tile_movieclip in the library. Here is the code:
    package {
    // importing classes
    import flash.display.Sprite;
    // end of importing classes
    public class Main extends Sprite {
    public function Main() {
    // variables and constants
    const NUMBER_OF_TILES:uint=20;
    const TILES_PER_ROW:uint=5;
    var tiles:Array=new Array();
    var tile:tile_movieclip;
    // end of variables and constants
    // tiles creation loop
    for (var i:uint=0; i<NUMBER_OF_TILES; i++) {
    tiles.push(Math.floor(i/2));
    trace("My tiles: "+tiles);
    // end of tiles creation loop
    // shuffling loop
    var swap,tmp:uint;
    for (i=NUMBER_OF_TILES-1; i>0; i--) {
    swap=Math.floor(Math.random()*i);
    tmp=tiles[i];
    tiles[i]=tiles[swap];
    tiles[swap]=tmp;
    trace("My shuffled tiles: "+tiles);
    // end of shuffling loop
    // tile placing loop
    for (i=0; i<NUMBER_OF_TILES; i++) {
    tile=new tile_movieclip();
    addChild(tile);
    tile.cardType=tiles[i];
    tile.x=5+(tile.width+5)*(i%TILES_PER_ROW);
    tile.y=5+(tile.height+5)*(Math.floor(i/TILES_PER_ROW));
    tile.gotoAndStop(NUMBER_OF_TILES/2+1);
    // end of tile placing loop
    Can someone please explain to me what I am suppose to do to make the this work? I beleive the problem is it doesnt know where the tiles are.
    Thanks.

    To create the tiles, draw 10 distinct shapes in the first 10 frames of your symbol, and
    the back of the tile in the 11th frame. You are free to draw them as you want, but I suggest you make them as 90 pixels squares with registration point (starting x and y position) at 0, because these are the properties of the tiles used in this chapter's
    examples. At least, they should all be the same size.
    It didnt say put in a library. It is saying to draw them in frames of symbol but it didnt walk me through that. Can you guide me through this? I also was looking at how to add the link identifier but it said I need a popup window but I cant see one. I thought that was done
    when I went to insert new symbol. It said something about actionscript linkage. I am familliar with perl, java and c++ so I can follow the code so far but I dont have much understanding of the flash interface. I made the 10 shape tiles and the 1 question mark tile
    in paint. They are .jpeg images.

  • 2 player web-based Flash game problem

    I have a two player web-based Flash game. The Flash calls a
    JavaScript function on the webpage to get and store the user's IP.
    Then an XML file with user's game data is loaded and parsed. The IP
    address is used to identify which player is player 1 and which is
    player 2 according to the XML file. There is a Java applet to send
    and receive messages between the players.
    The first player loads everything just fine. All the first
    player's messages regarding the progress in loading different parts
    of the code sent by the game for debugging are displayed in the
    Java applet's text box, but none of the second player's messages
    sent by the game for debugging are displayed.
    The problem is that the second player's ActionScript code
    appears not to be executing except that I do get a message in the
    game that the XML file attempted to load but was not successful.
    The IP address call is not made and no messages can be sent to the
    other player. The second player's Java applet displays only the
    messages for debugging that came from the first player's game and
    any chat messages sent by the first player.
    This problem always happens to the second player, never to
    the first player. Both player's are always using IE6 or IE7.
    Does anyone have some idea(s) what could cause only the
    second player's ActionScript code not to execute and/or not to load
    an XML file correctly?
    This is just a general question, so any general answers would
    be appreciated. Code specific answers are hopefully not required.
    Thank You in advance.

    Hi,
    I am not very familiar with the multiplayer Game development. For multiplayer games, you'll need to set up a matchmaking server and have the clients connect to it. It can then pair them off and facilitate communications. If the clients have publicly available
    network addresses then it can introduce them and they can talk directly to each other.There isn't anything built in for this so you'll need to either build your own or find a third party implementation. If you are using Unity3d then check out
    http://docs.unity3d.com/Documentation/Components/net-MasterServer.html
    Also, you can use Xbox services, and I find an article below:
    https://msdn.microsoft.com/en-us/library/bb975801.aspx
    For windows Azure problem, you should go to windows Azure forum.
    Best Wishes!
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place. <br/> Click <a
    href="http://support.microsoft.com/common/survey.aspx?showpage=1&scid=sw%3Ben%3B3559&theme=tech"> HERE</a> to participate the survey.

  • Flash Video Player Need Help

    Hello everyone I am hoping someone here can help me.  I am going to school and I have an action scripting class.  For my final project we have to make a flash video player with a custom skin to upload to our websites. We did something similar to this with our first project which we made a player where the movies where embedded in the file itself but this is supposed to be a youtube like flash player where we can call in the files from another source.   
      We kind of got pressed for time and were not able to go into detail with this project so the teacher gave us the code and I put it in exactly how it should be but im pretty sure i have something misplaced or I am missing a step. I get 8 different errors when I go to test the movie. and nothing works.  Can someone please tell me what I am doing wrong or can you point me in the direction of a tutorial on this  as I have been searching for tutorials on this with no luck. 
    Here is my Action Script 3.0 CODE:
    import fl.video.FLVPlayback;
    import fl.controls.List;
    var vid:FLVPlayback = new FLVPlayback();
    vid.source= "fashion.flv";
    addChild(vid);
    vid.skin="SkinOverPlayStopSeekMuteVol.swf";
    vid.x=100;
    vid.y=300;
    vid.skinAutoHide="true";
    vid.width=500;
    vid.height=280;
    var vidList:List = new List();
    vidList.x= vid.x+10;
    vidList.y= 200;
    vidList.width=200;
    vidList.height=100;
    vidList.addItem({label:"Bathroom Behavior",data: "bathroom.flv"});
    vidList.addItem({label:"Chase Scene",data: "chase.flv"});
    vidList.addItem({label:"VMCAD Fashion Design Commercial",data: "fashion.flv"});
    addChild(vidList);
    vidList.addEventListener(Event.CHANGE,playVid);
    function playVid(e:Event):void{     
    vid.source=e.target.selectedItem.data;
    Here is a screenshot of the errors I am receiving.
    Please help me 
    thanks
    Message was edited by: BTwardy

    I don't know if what you posted is all that is in that as file, but you need to declare a package, then call the import statements, then declare the class name.  Like this:
    package {
         import flash.display.Sprite;
         import flash.events.Event;
         import fl.video.FLVPlayback;
         import fl.controls.List;
         public class Main extends Sprite {
              public function Main() {
                   var vid:FLVPlayback = new FLVPlayback();
                   vid.source= "fashion.flv";
                   addChild(vid);
                   vid.skin="SkinOverPlayStopSeekMuteVol.swf";
                   vid.x=100;
                   vid.y=300;
                   vid.skinAutoHide="true";
                   vid.width=500;
                   vid.height=280;
                   var vidList:List = new List();
                   vidList.x= vid.x+10;
                   vidList.y= 200;
                   vidList.width=200;
                   vidList.height=100;
                   vidList.addItem({label:"Bathroom Behavior",data: "bathroom.flv"});
                   vidList.addItem({label:"Chase Scene",data: "chase.flv"});
                   vidList.addItem({label:"VMCAD Fashion Design Commercial",data: "fashion.flv"});
                   addChild(vidList);
                   vidList.addEventListener(Event.CHANGE,playVid);
              function playVid(e:Event):void{     
                   vid.source=e.target.selectedItem.data;
    Then click on your stage in Flash, then open the properties window, and fill the Class text field with:   Main
    Make sure the as file is saved in the same folder as the flv.

  • Flash Game Problem

    I've posted in several forums looking for answers and have yet to receive a response.  I've had this problem for over a year and I've yet to figure out the cause.
    My problem: I have lag in flash games whenever I input a command (ie - push a key to do something in a game).  The lag is a delay in the graphic update after inputing a command (ie - moving left in a game takes a second and then appears to "jump"...aka it's not smooth animation).
    I've had this problem since I got my computer.  Here's all the specs and software I'm using:
    Mobile Core 2 Duo T7600G @ 2.33ghz
    Nvidia Geforce Go 7950GTX Driver Version: 7.15.11.8520
    4 gigs PC-5300 DDR2 memory
    Windows Vista Ultimate SP1 all latest updates
    Firefox version 3.5.1
    Flash Version 10.0.22.87
    I've done a fresh install of OS, Firefox, and Flash. All BIOS are update to date. I monitor CPU usage while playing flash games and the firefox process (firefox.exe) uses about 30% of the CPU so the game isn't exactly a workout for my computer. The games (or videos) runs like silk as long as I'm not imputing commands (ie playing the game). I've monitored CPU rating to insure CPU is not running at a reduced power mode during tests.
    I defrag my HD regularly and update all other drivers as necessary.  All anti-virus (avast) and anti-spyware (ad-aware and spybot) programs are up to date and scanning my computer regularly.  I've set them on active and passive to test if they were the problem but they are surely not interferring (trust me I've tested extensively).
    In conclusion: my computer work 100% great except for this problem and I have no idea what's wrong.  I'm convinced it's just 1 setting that needs to be tweaked but I've yet to come across that tweak.
    Any suggestions/help would be appreciated.  Thanks!

    I forgot to add this is ALL flash games.  When I say ALL I mean every single one I've ever playedr regardless of detail.

  • Flash Player is causing my Web Pages to flash like crazy Need help!

    I need help, I'm running a computer with Windows 98 4.10.1998
    and Running Internet Explorer ver. 6.0.2800.1106IC
    I had some problems I have fix eveything but when I got to a
    web page it wants
    to install and run flash player if I do Install and run, all
    my web pages flash
    like crazy every clickable icon or line flash the screen
    makes it flicker so hard
    it is enough to give you a headache. Ad boxes on the pages
    flash like a lighting
    strorm. How do I fix this? I never had this before, I ran the
    flash player debug file
    that made no change. Help!

    Already checked the Event Viewer. The only thing I could find is this critical level event
    The system has rebooted without cleanly shutting down first. This error could be caused if the system stopped responding, crashed, or lost power unexpectedly.
    This only happens when I am running a flash video in IE10. In Chrome everything works fine. I downgraded flash player to 11.4 but with no luck.
    From the event viewer, the reboots started from sometime in september.(this is my parents' pc)
    I think I found the problem. I changed my video card, a 9600GT, a few months ago with a GT630. I switched back to the 9600GT, and it looks like the issue is not happening any more. But it's still verry ackward for the issue to happen only on IE10.
    I'm still testing to be sure that the video card is the problem.

  • Car Customization (Flash Game) Problem

    I'm currently making a car customization flash game, i've already done the coloring part (while user click "Red", the car become "Red").
    The problem is i want to add an animation before changing the color, eg: when user click "Red", a sprayer is going left to right, and the car become "Red" after that. So i make a movie clip named "Spray", and i got 5 labels "Red", "Green", "Yellow", "Orange", "Blue" in following order, i add the movie clip in every label, but it look weird because when user click "Red", it play the movie clip and become "Red", after that user click "Orange", the car will become "Black" (Black is default color of the car) when playing the movie clip. And user click "Green", it become "Black" again before changing to "Green". It always become default color when user choose other colors.
    What i want is remain the car's color when user choose the other color, eg: when user choose "Red", it play the movie clip first, and become "Red", after that user choose "Orange", it play the movie clip and remain "Orange" color in the same time, after that it change to "Orange", and so on so forth.
    Any solution for this? Thanks

    Ok,i will describe the scene that i haven't make the "Spray" movie clip yet, so i won't confuse you. In the main scene, I got 1 movie clip, inside got few labels, as i mentioned before, "Red", "Green", "Yellow", "Orange", and "Blue" labels. Frame 1 contain a image, which is the black color's car image, the other labels contain different color of car image. So the sequence is Frame 1 is the black car, Frame 2 is the "Red" label, Frame 3 is the "Green" label, and continue until Frame 6.
    I got another movie clip which is in the main scene, inside this movie clip is a menu and button, which contain different type of buttons that allow user change the color. It only have 1 Frame, and here is the AS:
    var myCarArray = [Red, Green, Yellow, Orange, Blue];
    for each (var Car in myCarArray) {
        Car.addEventListener(MouseEvent.CLICK, onCarClick);
      Car.buttonMode = true;
    function onCarClick (event:MouseEvent):void {
        MovieClip(parent).car_color.gotoAndStop(event.target.name);
    So what should i do in order to archive the target that i want? I need to show some animation before changing the car's color.

  • Flash game coder needed

    Hello everyone. I had planned on creating arcade games for iPhone and iPod Touch. I was good friends with a programmer who was willing to help me until he was recently recruited as a full-time programmer for an established company. I have changed my plans to creating free flash games for online play. I have enough money saved up to buy a domain name for my site but I am still in need of a Flash coder. If anyone on this forum has some free time and would be interested in helping me out in coding some simple games on a volunteer basis, reply to this thread and we can get in touch through email. I look forward to your responses. Thanks.
    UPDATE: Here's some additional art for reference. I have all art, music, and SFX completed for multiple games.

    Hello everyone. I had planned on creating arcade games for iPhone and iPod Touch. I was good friends with a programmer who was willing to help me until he was recently recruited as a full-time programmer for an established company. I have changed my plans to creating free flash games for online play. I have enough money saved up to buy a domain name for my site but I am still in need of a Flash coder. If anyone on this forum has some free time and would be interested in helping me out in coding some simple games on a volunteer basis, reply to this thread and we can get in touch through email. I look forward to your responses. Thanks.
    UPDATE: Here's some additional art for reference. I have all art, music, and SFX completed for multiple games.

  • Flash games problem with Mozilla Firefox

    Ok so, I'm trying to play one great flash game, I'm actually Texas hold'em addict :D so, as soon as I open it, firefox just crashes and that's it, nothing appears, no crash report or anything like that..
    I'm trying to play this game: [http://www.4yahoo.com/board-card/play-governor-of-poker-2 Governor of Poker 2] and this one [http://www.4yahoo.com/puzzle/play-the-forest-temple The Forest Temple]
    What to do? Should I reinstall it or it could be my windows problem?
    I don't really want to re-install it, because I have tons of bookmars there and got no idea how to save them, also I'm afraid that it will be waste of time.
    So I'm asking you guys, maybe someone faced this problem.
    Thanks in advance.

    I mean, it's ok when I run other games, but those two are the problem :(

  • Zen Vision:M problem, NEED HELP!

    My zen vision:m is starting to run slowly. It started right after my player froze and i reset it.Now its really slow and barely even switches screens sometimes.Right now its just a black screen with the keypad lit up.Whats wrong with it'sI NEED HELP!

    johnnnyp wrote:
    hi, i have a problem with my creative vision m. i wanted to watch a movie and it froze. i tried to shut it down but it wouldnt respond, and now is frozen. please help me if you can!
    You know its kinda rude to derail XBenzinoFla thread with your own problems, make your own thread next time.
    But to the both of you especially XBenzinoFla, try putting your ZVM in rescue mode and run scan disk to see if it hel
    ps.

  • Zen Micro problem need help

    Today i was listening to music and my zen micro just froze while playing and no buttons could be pressed and the lock button wasnt on. So i took the battery out and rebooted the player but it froze at the creative screen. I went home and i went to recovery mode and tried to reload the firmware but it said erasing firmware for more than 2 hours. So then i tried a format but it said formating for the same amount of time. I need help please. Also, recently i've had problems witht the headphone jack. When ever i would stick it in it would sound distorted and i would have to move it around until i got it to a certain spot to hear it good again. If anyone else has this problem please tell me. One more thing i had returned my other micro zen in for hard dri've probems and this was my new one do u think if i have to return in (hopefully not) that they would accept it.

    If the functions in Rescue Mode aren't working properly then you need to contact Creative Support.

  • Still stuck with the same old producer consumer weight problem need help

    Hello All,
    This is the problem I am stuck with right now.
    I have two array lists one producer array list and one consumer array list denoted by a and b
    P1 P2 P3 P4 P5
    5 6 7 8 9
    C1 C2 C3 C4 C5
    2 3 4 5 6
    Now we find all those producer consumer pairs which satisfy the criteria Pi>=Ci
    We have the following sets
    (5,2)(6,2)(7,2),(8,2),(9,2)
    (5,3)(6,3)(7,3),(8,3),(9,3)
    (5,4)(6,4)(7,4),(8,4),(9,4)
    (5,5)(6,5)(7,5),(8,5),(9,5)
    (6,6)(7,6)(8,6),(9,6)
    Let us done each of them with Si
    so we have S1,S2,S3,S4,S5
    we assign a third parameter called weight to each element in Si which has satisfied the condition Pi>=Ci;
    so we we will have
    (5,2,ai),(6,2,bi),(7,2,ci)....etc for S1
    similarly for S2 and so on.
    We need to find in each set Si the the pair which has the smallest weight.
    if we have (5,2,3) and (6,2,4) then 5,2,3 should be chosen.We should make sure that there is only one pair in every set which is finally chosen on the basis of weight.
    Suppose we get a pair (5,2,3) in S1 and (5,2,3) in S2 we should see that (5,2,3) is not used to compare to compare with any other elements in the same set S2,
    Finally we should arrive at the best element pair in each set.They should be non repeating in other sets.
    Given a problem
    P0 P1 P2 P3 P4
    9 5 2 2 8
    6 5 4 5 3
    C0 C1 C2 C3 C4
    we have So as (P0,C0) and (P4,C0)
    assuming that the one with the smaller index has lesser weight PO is selected.In the program I have used random weights.from set S1 we select the pair PO,CO
    S1 =(P0,C1),(P1,C1) and (P4,C1)
    since P0 and P4 are already used in previous set we dont use them for checking in S1 so we have (P1,C1) as best.
    S2=(P0,C2),(P1,C2) and (P4,C2) so we dont use P0,C2 and P1 and C2 because PO and P1 are already used in S1.
    So we choose P4,C2
    in S3 and S4 ae have (P0,C3),(P1,C3),(P4,C3) so we dont choose anything
    and same in S4 also.
    So answer is
    (P0,C0),(P1,C1) and (P4,C2).
    My program is trying to assign weights and I am trying to print the weights along with the sets.It doesnt work fine.I need help to write this program to do this.
    Thanks.
    Regards.
    NP
    What I have tried till now.
    I have one more question could you help me with this.
    I have an array list of this form.
    package mypackage1;
    import java.util.*;
    public class DD
    private  int P;
    private  int C;
    private int weight;
    public void set_p(int P1)
    P=P1;
    public void set_c(int C1)
    C=C1;
    public void set_weight(int W1)
    weight=W1;
    public int get_p()
    return P;
    public int get_c()
    return C;
    public int get_x()
    return weight;
    public static void main(String args[])
    ArrayList a=new ArrayList();
    ArrayList min_weights_int=new ArrayList();
    ArrayList rows=new ArrayList();
    ArrayList temp=new ArrayList();
    Hashtable h=new Hashtable();
    String v;
    int o=0;
    DD[] d=new DD[5];
    for(int i=0;i<4;i++)
    d=new DD();
    for(int i=0;i<4;i++)
    d[i].set_p(((int)(StrictMath.random()*10 + 1)));
    d[i].set_c((int)(StrictMath.random()*10 + 1));
    d[i].set_weight(0);
    System.out.println("Producers");
    for(int i=0;i<4;i++)
    System.out.println(d[i].get_p());
    System.out.println("Consumers");
    for(int i=0;i<4;i++)
    System.out.println(d[i].get_c());
    System.out.println("Weights");
    for(int i=0;i<4;i++)
    System.out.println(d[i].get_x());
    for(int i=0;i<4;i++ )
    int bi =d[i].get_c();
    ArrayList row=new ArrayList();
    for(int j=0;j<4;j++)
    if( d[j].get_p() >=bi)
    d[j].set_weight((int)(StrictMath.random()*10 + 1));
    row.add("(" + bi + "," + d[j].get_p() + "," +d[j].get_x() + ")");
    else
    d[j].set_weight(0);
    row.add("null");
    rows.add(row);
    System.out.println(rows);
    int f=0;
    for(Iterator p=rows.iterator();p.hasNext();)
    temp=(ArrayList)p.next();
    String S="S" +f;
    h.put(S,temp);
    String tt=new String();
    for(int j=0;j<4;j++)
    if(temp.get(j).toString() !="null")
    // System.out.println("In if loop");
    //System.out.println(temp.get(j).toString());
    String l=temp.get(j).toString();
    System.out.println(l);
    //System.out.println("Comma matches" + l.lastIndexOf(","));
    //System.out.println(min_weights);
    f++;
    for(Enumeration e=h.keys();e.hasMoreElements();)
    //System.out.println("I am here");
    int ii=0;
    int smallest=0;
    String key=(String)e.nextElement();
    System.out.println("key=" + key);
    temp=(ArrayList)h.get(key);
    System.out.println("Array List" + temp);
    for( int j=0;j<4;j++)
    String l=(temp.get(j).toString());
    if(l!="null")
    System.out.println("l=" +l);
    [\code]

    In your example you selected the pair with the greatest
    distance from the first set, and the pair with the least
    distance from the second. I don't see how the distance
    function was used.
    Also it's not clear to me that there is always a solution,
    and, if there is, whether consistently choosing the
    furthest or the closest pairs will always work.
    The most obvious approach is to systematically try
    all possibilities until the answer is reached, or there
    are no possibilities left. This means backtracking whenever
    a point is reached where you cannot continue. In this case
    backtrack one step and try another possibility at this
    step. After all possible choices of the previous step,
    backtrack one more step and so on.
    This seems rather involved, and it probably is.
    Interestingly, if you know Prolog, it is ridiculously
    easy because Prolog does all the backtracking for you.
    In Java, you can implement the algorithm in much the same
    way as Prolog implementations do it--keep a list of all the
    choice points and work through them until success or there
    are none left.
    If you do know Prolog, you could generate lots of random
    problems and see if there is always a solution.

Maybe you are looking for

  • How can I execute a dos command?

    I tryed so: import java.io.BufferedReader; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintStream; public class Builder {      public static void main(String[]args)                //m

  • Can't delete bookmarks or add bookmarks on my iOS7 Safari.

    I have a iPad2 wifi 16gb. I want to delete bookmarks from Safari. I have tried everything from the forums, "edit>delete. Nothing. My bookmarks are locked and won't delete. I can't add any as well. Anyone can help? Is this a bug?

  • Ref.Cursor Problem - URGENT

    Hi Friends, For my report ( calc.rdf ) , I am passing two input parameters P_Client_ID, P_Plan_ID. In .rdf, I had a ref.cursor for selecting records based on two input parameters values. case1: P_client_ID = 'SRINI' P_Plan_ID = '3232' My report is ge

  • I don't have iDVD but i need it, where can i find the app to download it on my mac ?

    I don't have iDVD but i need it, where can i find the app to download it on my mac ?

  • Global color adjustment for an icon illustration?

    I've built an icon, using many component parts each with a different stroke and fill characteristics. I now want to change the overall color of the icon, without having to go in adjust each component part that makes up the icon. (In PS, for example.