Search Results

Search found 2 results on 1 pages for 'joox'.

Page 1/1 | 1 

  • javascript. is it posible for one member of an object to access another member of that object withou

    - by joox
    For example: var myObj={ myValue="hola", asMember=function(){ alert( this.myValue ); } }; myObj.asMember(); // will work fine var asGlobal=myObj.asMember; // global alias for that member function asGlobal(); // won't work in javascript (will work in AS3, but i need js now) So the question is, can I rewrite asMember so that it could be called by global alias and without mentioning myObj at all? It's understood that if I define it: asMember=function(){ alert( myObj.myValue ); } it will work, but in my case, mentioning myObj is not acceptable even inside the function itself (because myObj may be reassigned later, but asGlobal won't change and should keep working)

    Read the article

  • .net Drawing.Graphics.FromImage() returns blank black image

    - by joox
    I'm trying to rescale uploaded jpeg in asp.net So I go: Image original = Image.FromStream(myPostedFile.InputStream); int w=original.Width, h=original.Height; using(Graphics g = Graphics.FromImage(original)) { g.ScaleTransform(0.5f, 0.5f); ... // e.g. using (Bitmap done = new Bitmap(w, h, g)) { done.Save( Server.MapPath(saveas), ImageFormat.Jpeg ); //saves blank black, though with correct width and height } } this saves a virgin black jpeg whatever file i give it. Though if i take input image stream immediately into done bitmap, it does recompress and save it fine, like: Image original = Image.FromStream(myPostedFile.InputStream); using (Bitmap done = new Bitmap(original)) { done.Save( Server.MapPath(saveas), ImageFormat.Jpeg ); } Do i have to make some magic with g? upd: i tried: Image original = Image.FromStream(fstream); int w=original.Width, h=original.Height; using(Bitmap b = new Bitmap(original)) //also tried new Bitmap(w,h) using (Graphics g = Graphics.FromImage(b)) { g.DrawImage(original, 0, 0, w, h); //also tried g.DrawImage(b, 0, 0, w, h) using (Bitmap done = new Bitmap(w, h, g)) { done.Save( Server.MapPath(saveas), ImageFormat.Jpeg ); } } same story - pure black of correct dimensions

    Read the article

1