tags:

views:

42

answers:

0

Hi,

i'm doing a website with some flash content in its home page, i have 5 videos to show in it, for that i have used ajax and javascript to give a next link and previous link option in it. so when a user click on the next link he can see the next video. the first video is working perfectly, but when i click on the next link, ajax is working and the first flash file is replacing with the second one( this i can see when i look in to its view source) , but the video is not showing there. only this problem is showing when i'm playing with flash video.

in other case when i have some text in that ajax code, its showing there.

every thing is ok, no error showing in it....

but the second and all other flash videos are not displaying.

is there any problem with this script

can anyone help me???

i'm including my codes below.

here is the code from my home page


1) { if ($page==0) { $nt=$page+1; $prev=""; $next=""; } else if ($page==($pages-1)) { $pv=$page-1; $prev=""; $next=""; } else { $pv=$page-1; $nt=$page+1; $prev=""; $next=""; } } else { $prev=""; $next=""; } ?> 0) { while($page_cont=mysql_fetch_array($result)) {?> var so = new SWFObject('flash/player.swf','mpl','858','357','9'); so.addParam('allowfullscreen','true'); so.addParam('allowscriptaccess','always'); so.addParam('wmode','opaque'); so.addVariable('file',''); so.addVariable('autostart','true'); so.addVariable('repeat','always'); so.write("container");

here is the code from that ajax page


function getXMLHTTP() { //fuction to return the xml http object var xmlhttp=false;
try{ xmlhttp=new XMLHttpRequest(); } catch(e) {
try{
xmlhttp= new ActiveXObject("Microsoft.XMLHTTP"); } catch(e){ try{ xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); } catch(e1){ xmlhttp=false; } } }

    return xmlhttp;
}

function getDestination(page) {     

    var strURL="common_action.php?action=find_destination&page="+page;
    var req = getXMLHTTP();

    if (req) {

        req.onreadystatechange = function() {
            if (req.readyState == 4) {
                // only if "OK"
                if (req.status == 200) {                        
                    document.getElementById('pagingdiv').innerHTML=req.responseText;
                } else {
                    alert("There was a problem while using XMLHTTP:\n" + req.statusText);
                }
            }               
        }           
        req.open("GET", strURL, true);
        req.send(null);
    }       
}

here is the code for common action page, where the code is replacing using ajax


switch($_REQUEST['action']) { // Finding all the destinations of the selected country case "find_destination":

        ?>
                <?php
                  $page_name="indextest.php";
                  $max=1;
                  $sql="select * from da_homes where active='1'";
                  $rs=mysql_query($sql);

                 $total=mysql_num_rows($rs);        

                 $page=$_REQUEST['page'];
                    if(!$page) $page=0;

                 $start=$page*$max;

                 $sql=$sql." LIMIT $start,$max";

                 $result=mysql_query($sql); 

                $pages=ceil($total/$max);

        if($pages>1)
        {
            if ($page==0)
                {
                    $nt=$page+1;
                    $prev="<img src='images/prevbutn_dact.jpg' alt='Previous' border='0' align='left'/>";
                    $next="<a href='javascript:;' onclick='getDestination($nt)' ><img src='images/nextbutn.jpg' alt='Next' border='0' align='right' /></a>";                
                }
            else if ($page==($pages-1))
                {
                    $pv=$page-1;
                    $prev="<a href='javascript:;' onclick='getDestination($pv)'><img src='images/prevbutn.jpg' alt='Previous' border='0' align='left' /></a>";
                    $next="<img src='images/nextbutn_dact.jpg' alt='Next' border='0' align='right'/>";              
                }   
            else 
                {
                    $pv=$page-1;
                    $nt=$page+1;
                    $prev="<a href='javascript:;' onclick='getDestination($pv)'><img src='images/prevbutn.jpg' alt='Previous' border='0' align='left'  /></a>";
                    $next="<a href='javascript:;' onclick='getDestination($nt)'><img src='images/nextbutn.jpg' alt='Next' border='0' align='right' /></a>";
                }
        }
    else
        {
            $prev="";
            $next="";
        }

        ?>

           <?php                    
            if($total>0)
                {

                    while($page_cont=mysql_fetch_array($result))
                        {?>
                            <?php if($pages!=1)
                            {?>

                                    <div class="prevbutn"><?php echo $prev;?></div><?php }?>
                                    <div class="videocontent"> 
                                     <div id="container"></div>   


                            <script type="text/javascript" src="http://dt-server/projects/Local/Datitude/datitude_studio/code/js/swfobject.js"&gt;&lt;/script&gt;
                                    <script type="text/javascript">
                                        var so = new SWFObject('http://dt-server/projects/Local/Datitude/datitude_studio/code/flash/player.swf','mpl','858','357','9');
                                          so.addParam('allowfullscreen','true');
                                          so.addParam('allowscriptaccess','always');
                                          so.addParam('wmode','opaque');
                                          so.addVariable('file','<?=URL."uploads/homevideos/".$page_cont["video"]?>');
                                          so.addVariable('autostart','true');
                                          so.addVariable('repeat','always');
                                        so.write("container");

                                    </script>


                                            </div>
                                    <div class="nextbutn"><?php echo $next;?></div>
                                    <div class="clr"></div>
                                <?php
                                    }
                                }

        break;

}//end switch