Jump to content

astralaaron

Members
  • Posts

    1,254
  • Joined

  • Last visited

Everything posted by astralaaron

  1. is it safe to say that it is working in IE10 / 9 if it is working in 11? Like I said when I try to use the document mode in developer tools it stops working..I read somewhere while searching Google, it said that "You can't trust the browser developer tools document mode, you need to test on a legitimate copy" Is there a way to install old versions of IE?
  2. astralaaron

    css positioning

    <br style="clear:both"> instead of empty paragraph
  3. well, It works in IE11. My only concern now is that when I use IE11 and I browser simulate in IE10 and IE9 it stops working... is this because it doesnt work when developer tools are on, or it actually doesn't work in IE10 and 9???
  4. thanks for the response but I actually thought that right after posting and it doesnt fix the problem
  5. Is there an issue with the window.event and having the IE developer tools open? I tried on a computer with IE10 and it worked, I realized that developer tools / console were closed and I hadn't tried that previously. Then I opened the developer tools to test IE9 and it doesn't work. Mouse x y is NaN... I need to be able to test this on IE9 is there any other way besides the developer tools browser version setting?
  6. any idea why this wouldn't be working? I am still getting NaN for the x and y in IE. I tried if(!event) event = window.event; and if(!event) var event = window.event; // as shown on the link you sent me here is the function: this.mouseXY = function (event){ if(!event) var event = window.event; var totalOffsetX = 0; var totalOffsetY = 0; var canvasX = 0; var canvasY = 0; var canvas = this; do{ totalOffsetX += canvas.offsetLeft; totalOffsetY += canvas.offsetTop; } while(canvas = canvas.offsetParent) canvasX = event.pageX - totalOffsetX; canvasY = event.pageY - totalOffsetY;return {'x':canvasX, 'y':canvasY}} does it make any difference that this function is a prototype of the canvas element? It is also called from another event listener 'mousemove' and 'click' this.mouseMove = function(event) { if(!event) var event = window.event; x.mouse = x.canvas.xy(event); console.log(x.mouse.x + ' ' + x.mouse.y);}
  7. I am running into an issue with IE... I have a prototype attached to my canvas which returns the current mouse position. It is working fine in Firefox, and I have also had it working fine with IE in a different project...but for the life of me I can't catch what I am doing wrong in this case. here is my prototype that is attached to my canvas element: this.mouseXY = function (event){ var totalOffsetX = 0; var totalOffsetY = 0; var canvasX = 0; var canvasY = 0; var canvas = this; do{ totalOffsetX += canvas.offsetLeft; totalOffsetY += canvas.offsetTop; } while(canvas = canvas.offsetParent) canvasX = event.pageX - totalOffsetX; canvasY = event.pageY - totalOffsetY;return {'x':canvasX, 'y':canvasY}} when I grab the X/Y with my mouse object which looks like this.mouse = {'x':0, 'y':0}; in Firefox I am getting numbers, but in IE it is returning NaN / NaN... any ideas? I have tried using parseInt() with no luck..I do understand that NaN is a value which a number type can have.. any insight is greatly appreciated... EDIT: the following is how the prototype is implemented, maybe there is an issue here? HTMLCanvasElement.prototype.xy = e.mouseXY; if(window.attachEvent) { x.canvas.attachEvent('onclick', e.mouseClick); x.canvas.attachEvent('onmousemove', e.mouseMove); } else { x.canvas.addEventListener('click', e.mouseClick, false); x.canvas.addEventListener('mousemove', e.mouseMove, false); }
  8. I have been up all night trying to figure this out, please point out what I am doing wrong! $laTimezone = new DateTimeZone('America/Los_Angeles');$nyTimezone = new DateTimeZone('America/New_York'); // viewer is in NY and should see what time in NY it will be when it is 4:40 in LA.$laDateTime = new DateTime('2014-02-05 16:40', $laTimezone); //user scheduled for 4:40 Feb 5th (LA TIME ZONE)$offset = $nyTimezone->getOffset($laDateTime);$nyDateTime = date('Y-m-d H:i', $laDateTime->format('U') + $offset);echo $laDateTime->format('Y-m-d H:i') . ' in (LA) is ' . $nyDateTime . ' in (NY) '; Basically, someone posts a "meeting" time in Los Angeles at 2014-02-05 16:40. Someone in New York browsing the posts sees the meeting from Los Angeles, but instead of 2014-02-05 16:40, they see 2014-02-05 19:40 because that is what time it will be in NY when it is 16:40 in LA. I can't seem to get it working the way I want it. EDIT: here is the output: 2014-02-05 16:40 in (LA) is 2014-02-05 12:40 in (NY)
  9. I found this page interesting: http://socialmediatoday.com/pamdyer/1401166/role-color-marketing-infographics
  10. this seems to work perfect in FireFox, but then doesn't work in internet explorer.... is there a way to make it happen? document.execCommand("insertHTML", false, "<span class='own-class'>"+ document.getSelection()+"</span>");
  11. I have a ton of old pages written out with stuff like this: <font size="4"><b><u><font color="red">Chapter One</font></u></b></font><font size="3"><font color="black">Once upon a <b>time</b>....</font></font> would it be possible to convert these to span tags with inline style? even just the font tags.. for example: <span style="font-size:16px;font-weight:bold;color:red;text-decoration:underline;">Chapter One</style>or even<b><u><span style="font-size:16px;color:red;">Chapter One</style></b></u>
  12. So, the following works, but I can't figure out how to get it to work within my class files function date_compare($a, ${ $t1 = strtotime($a['when']); $t2 = strtotime($b['when']); return $t1 - $t2;}usort($array, 'date_compare'); the way usort takes in a string as a function name is throwing me off. How do I pass date_compare() as member of my class instead of just a function? I want to be able to do this sorting within the getPosts function instead of procedurally after the result is returned.. I thought this would work within my class but no luck: usort($array, function ($a, ${ $t1 = strtotime($a['when']); $t2 = strtotime($b['when']); return $t1 - $t2;}); any ideas?
  13. EDIT: mysqli_multi_query() to array to sort I have a few tables that I want to pull into one query result. I can get a multi array with the following code: public function getPosts( ) { $data= array(); $queries =" SELECT * FROM `imagePosts`; "; $queries .= " SELECT * FROM `messages`; "; $queries .= " SELECT * FROM `videos`; "; $exe = parent::database()->multi_query($queries); if (!$exe) { printf("Error: %sn", parent::database()->error); return false; } do { if ($result = parent::database()->store_result()) { while ($row = $result->fetch_array(MYSQLI_ASSOC)) { $data[] = $row; } $result->free(); } if (!parent::database()->more_results()) { break; } } while (parent::database()->next_result()); return $data; } There are a few examples of sorting arrays with usort() that I found, but for some reason I just cannot understand how that function works... There is a datetime field in my tables that I want to sort by which should mix the table results together.. Does anyone understand how to sort an array by a date field?
  14. thanks for the input JSG. I like the second suggestion that you made.
  15. Say I have something similar to YouTube's thumbs up and down for certain content on a site... is this a good way to go about handling the data? - each post will have fields for the thumbs up / down count. - there will be a table which keeps track of all thumbs up / down entries as well as the user Id The table to track all of them would be so I can make sure the same user is not pressing thumbs up or down multiple times.. I guess what I am worried about is the queries going really slow after that thumbs up/down table gets really big. Any advice? or do I have the right idea?
  16. i actually just wanted to capitalize some letters in a long URL to make it more readable but I didnt think that though obviously
  17. Is is possible to change what the user sees in the address bar but not load the page? for example : would become:
  18. ahhh sounds are driving me crazy.... in internet explorer it seems as if the sounds download every time it is fired...so even a little 1 second sound file downloads (status 200) each time you click on something in the game...so in IE it delays about 1 second before firing each sound....
  19. I am going back to this method...but I am having an issue with Chrome (again....) here is the code I am using for the preload: this.loadSounds = function( path, snd ) { if (snd.length < 1) LOADED_SND = true; var loadedSounds = 0; for (var i = 0; i < snd.length; i++) { var temp = new Audio(); document.body.appendChild(temp); temp.addEventListener("canplaythrough", function() { loadedSounds++; console.log('SOUND LOADED ' + loadedSounds); if (loadedSounds == snd.length){ LOADED_SND = true; console.log('LOADED_SND ' + LOADED_SND); } }, true); if (temp.canPlayType('audio/ogg')) { temp.type = "audio/ogg"; console.log('temp canPlayType ogg'); temp.src = path + snd[i] + ".ogg"; } else { console.log('temp canPlayType mp3'); temp.type = "audio/mpeg"; temp.src = path + snd[i] + ".mp3"; } //temp.preload = "auto"; console.log('after canplaythrough event set'); } } The issue now is that after all of the sounds preload, Chrome will not play the sound when I create another instance of it. For example, this loading happens before each stage runs its "init()" function. The sounds get loaded, then the init() gets run. within the init function there is something like this: this.bgMusic = new Audio(); //this line is actually called when the object of the class is created, not in the init()if (this.bgMusic.canPlayType('audio/ogg')) { this.bgMusic.type = "audio/ogg"; this.bgMusic.src = "audio/Clasico.ogg"; } else { this.bgMusic.type = "audio/mpeg"; this.bgMusic.src = "audio/Clasico.mp3"; } this.bgMusic.play(); The problem which seems to be happening, is after the preload function, when trying to load / play that sound later in the game, it doesn't play. From watching the network tools, it appears that it will not call the same sound file twice. it says status "pending". now if I change it and add a random number to the end of the sound file name (similar to AJAX requests to the same file), then it will call the file and play the sound. for example: this.loadSounds = function( path, snd ) { if (snd.length < 1) LOADED_SND = true; var loadedSounds = 0; for (var i = 0; i < snd.length; i++) { var rand = Math.floor(Math.random() * 100) + 1; var temp = new Audio(); document.body.appendChild(temp); temp.addEventListener("canplaythrough", function() { loadedSounds++; console.log('SOUND LOADED ' + loadedSounds); if (loadedSounds == snd.length){ LOADED_SND = true; console.log('LOADED_SND ' + LOADED_SND); } }, true); if (temp.canPlayType('audio/ogg')) { temp.type = "audio/ogg"; console.log('temp canPlayType ogg'); temp.src = path + snd[i] + ".ogg" + "?r=" + rand; } else { console.log('temp canPlayType mp3'); temp.type = "audio/mpeg"; temp.src = path + snd[i] + ".mp3" + "?r=" + rand; } //temp.preload = "auto"; console.log('after canplaythrough event set'); } } My concern is...if I am doing this, and adding a variable to the end of the sound file...wouldn't it be ignoring the cached file and downloading the entire file again when I try to play it in my game?
  20. I guess I will have to settle with "canplaythrough" even though chrome fires it immediately...
  21. ahhh appears as if the ajax preloading is not working at all.. status 200 again once the sound starts playing in IE and 206 status in chrome and firefox
×
×
  • Create New...